Posts

Showing posts from June, 2007

Change Atop Log Interval From 10 Minutes To 1 Minute

Answer : On recent versions the configuration file used by systemd is /usr/share/atop/atop.daily (see /etc/systemd/system/multi-user.target.wants/atop.service ). Here you can change the variable INTERVAL and restart the atop service. Add the following line to /etc/atoprc , if the file doesn't exist create it: interval 60 atop no longer uses the /etc/default/atop file. Unless you are using an older version of atop . Then you might want to change INTERVAL=600 to INTERVAL=60 in /etc/default/atop . Try to edit the file /usr/share/atop/atop.daily and change INTERVAL= . Then: service atop restart

Can You Get Painted Or Certified Items In Rocket League With Trade-ins?

Answer : It is most certainly possible to get a painted and/or certified from a trade up. Below are two video examples of getting a painted, and then a painted and certified item from a trade up. These items are from the latest Turbo crate but the rules apply to any items traded up. Trade ups Painted Endo Painted and Certified Tachyon

Are There Any Tools To Convert Markdown To Wiki Text In Other Formats

Answer : Try Pandoc, a universal document converter: $ pandoc --help pandoc [OPTIONS] [FILES] Input formats: docbook, haddock, html, json, latex, markdown, markdown_github, markdown_mmd, markdown_phpextra, markdown_strict, mediawiki, native, opml, rst, textile Output formats: asciidoc, beamer, context, docbook, docx, dzslides, epub, epub3, fb2, html, html5, json, latex, man, markdown, markdown_github, markdown_mmd, markdown_phpextra, markdown_strict, mediawiki, native, odt, opendocument, opml, org, pdf*, plain, revealjs, rst, rtf, s5, slideous, slidy, texinfo, textile It's available for virtually every platform. Pandoc has a web tool for this.

3d Plot Matlab Code Example

Example: 3D plot matplotlib import matplotlib . pyplot as plt from mpl_toolkits . mplot3d import Axes3D fig = plt . figure ( ) ax = fig . add_subplot ( 111 , projection = '3d' )

Anime Roblox Id Code Example

Example: roblox animation id local Players = game : GetService ( "Spelers" ) local player = Players : FindFirstChild ( "Builderman" ) lokaal karakter = speler . Karakterlocal humanoid = character : FindFirstChild ( "Humanoid" ) local animation = Instance.new ( "Animatie" ) animatie . AnimationId =

Bash: Python3: Command Not Found (Windows, Discord.py)

Answer : In the python installed( "c:\\Installationpath\Python3.6.0" ) path you will find "python.exe" , just copy paste in the same place and rename it as "python3.exe" , now in the command prompt you can check python3 command should display your python installation. Don't forget to open a new terminal. On Windows the normal name for the python executable is python.exe (console program) or pythonw.exe (for GUI programs). The python executable is sometimes called python3 on some platforms, where the default ( python ) is the old python 2. On many UNIX-based (inc. Linux and OS X) systems, python 2 is used by system utilities, changing it could have bad consequences on those platforms, hence the name "python3". On Windows you should be fine - there are other issues on Windows but you won't get those unless you try to use more than one python version. In windows using git bash, python3 didn't worked for me: $ python --ve

Discord Snake Game Code Example

Example 1: how to make a snake game dont ask me , how would I know ? Example 2: snake game So you dont like playing the classic version of the snake game huh ?

Youtube Mp33 Code Example

Example: youtube download mp3 I use https : //github.com/ytdl-org/youtube-dl/ as a Python CLI tool to download videos

Android: How To Adjust Margin/Padding In Preference?

Answer : You could customize you checkbox like this: MyPreference.xml <CheckBoxPreference android:key="testcheckbox" android:title="Checkbox Title" android:summary="Checkbox Summary..." android:layout="@layout/custom_checkbox_preference_layout"> </CheckBoxPreference> and custom_checkbox_preference_layout.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:minHeight="?android:attr/listPreferredItemHeight" android:gravity="center_vertical" android:paddingLeft="16dip" android:paddingRight="?android:attr/scrollbarSize"> <LinearLayout android:layout_width="wrap_content" android:layout_height="match_parent"

Access IP Camera In Python OpenCV

Image
Answer : An IP camera can be accessed in opencv by providing the streaming URL of the camera in the constructor of cv2.VideoCapture . Usually, RTSP or HTTP protocol is used by the camera to stream video. An example of IP camera streaming URL is as follows: rtsp://192.168.1.64/1 It can be opened with OpenCV like this: capture = cv2.VideoCapture('rtsp://192.168.1.64/1') Most of the IP cameras have a username and password to access the video. In such case, the credentials have to be provided in the streaming URL as follows: capture = cv2.VideoCapture('rtsp://username:password@192.168.1.64/1') This works with my IP camera: import cv2 #print("Before URL") cap = cv2.VideoCapture('rtsp://admin:123456@192.168.1.216/H264?ch=1&subtype=0') #print("After URL") while True: #print('About to start the Read command') ret, frame = cap.read() #print('About to show frame of Video.') cv2.imshow("C

40 Min Timer Code Example

Example: 20 minute timer for good eyesight every 20 minutes look out the window at something 20 feet away for 20 seconds

Assign Specific Colours To Data In Matplotlib Pie Chart

Image
Answer : Here's an idea you could try. Make a dictionary from your labels and colors, so each color is mapped to a label. Then, after making the pie chart, go in an assign the facecolor of the wedge using this dictionary. Here's an untested bit of code which might do what you are looking for: import numpy as np import matplotlib.pyplot as plt def mypie(slices,labels,colors): colordict={} for l,c in zip(labels,colors): print l,c colordict[l]=c fig = plt.figure(figsize=[10, 10]) ax = fig.add_subplot(111) pie_wedge_collection = ax.pie(slices, labels=labels, labeldistance=1.05)#, autopct=make_autopct(slices)) for pie_wedge in pie_wedge_collection[0]: pie_wedge.set_edgecolor('white') pie_wedge.set_facecolor(colordict[pie_wedge.get_label()]) titlestring = 'Issues' ax.set_title(titlestring) return fig,ax,pie_wedge_collection slices = [37, 39, 39, 38, 62, 21, 15, 9, 6, 7, 6, 5, 4

Array Php Append Code Example

Example 1: php append to array $myArr = [ 1 , 2 , 3 , 4 ] ; array_push ( $myArr , 5 , 8 ) ; print_r ( $myArr ) ; // [1, 2, 3, 4, 5, 8] $myArr [ ] = - 1 ; print_r ( $myArr ) ; // [1, 2, 3, 4, 5, 8, -1] Example 2: php append element to array array_push ( $cart , 13 ) ; Example 3: array_push in php <?php // Insert "blue" and "yellow" to the end of an array: $a = array ( "red" , "green" ) ; array_push ( $a , "blue" , "yellow" ) ; print_r ( $a ) ; ?> Example 4: array push in php $cart = array ( ) ; $cart [ ] = 13 ; $cart [ ] = 14 ; // etc //Above is correct. but below one is for further understanding $cart = array ( ) ; for ( $i = 0 ; $i <= 5 ; $i ++ ) { $cart [ ] = $i ; } echo "<pre>" ; print_r ( $cart ) ; echo "</pre>" ;

Android Studio - Get Firebase Token From GetIdToken

Answer : Your second approach is close, you just need to use <GetTokenResult> instead of <UploadTask.TaskSnapshot> as that is for uploading images using Firebase Storage. Try this: user.getIdToken(true).addOnSuccessListener(new OnSuccessListener<GetTokenResult>() { @Override public void onSuccess(GetTokenResult result) { String idToken = result.getToken(); //Do whatever Log.d(TAG, "GetTokenResult result = " + idToken); } });

Can't Connect To PPTP VPN With Ufw Enabled On Ubuntu 14.04 With Kernel 3.18

Answer : This is caused by a change for security reason in kernel 3.18 [1]. There are two ways to fix this. First approach is adding this rule to the file /etc/ufw/before.rules before the line # drop INVALID packets ... -A ufw-before-input -p 47 -j ACCEPT Second approach is manually loading the nf_conntrack_pptp module. You can do this by running sudo modprobe nf_conntrack_pptp To load this module on every boot on Ubuntu, add it to the file /etc/modules . For more recent versions of ufw a solution is instead: sudo ufw allow proto gre from [PPTP gateway IP address] sudo systemctl restart ufw Add nf_conntrack_pptp to /etc/modules-load.d/pptp.conf One liner echo nf_conntrack_pptp | sudo tee /etc/modules-load.d/pptp.conf Explanation The accepted answer works for me, especially the 2nd suggestion--loading the nf_conntrack_pptp kernel module--as opposed to modifying my iptables firewall. My laptop firewall is otherwise unmodified. sudo ufw enable without excepti

Alternatives To Git Submodules?

Answer : Which is best for you depends on your needs, desires, and workflow. They are in some senses semi-isomorphic, it is just some are a lot easier to use than others for specific tasks. gitslave is useful when you control and develop on the subprojects at more of less the same time as the superproject, and furthermore when you typically want to tag, branch, push, pull, etc all repositories at the same time. gitslave has never been tested on windows that I know of. It requires perl. git-submodule is better when you do not control the subprojects or more specifically wish to fix the subproject at a specific revision even as the subproject changes. git-submodule is a standard part of git and thus would work on windows. git-subtree provides a front-end to git's built-in subtree merge strategy. It is better when you prefer to have a single-repository "unified" git history. Unlike the subtree merge strategy, it is easier to export changes to the different (dire

Bulk Update In Pymongo Using Multiple ObjectId

Answer : Iterate through the id list using a for loop and send the bulk updates in batches of 500: bulk = db.testdata.initialize_unordered_bulk_op() counter = 0 for id in ids: # process in bulk bulk.find({ '_id': id }).update({ '$set': { 'isBad': 'N' } }) counter += 1 if (counter % 500 == 0): bulk.execute() bulk = db.testdata.initialize_ordered_bulk_op() if (counter % 500 != 0): bulk.execute() Because write commands can accept no more than 1000 operations (from the docs ), you will have to split bulk operations into multiple batches, in this case you can choose an arbitrary batch size of up to 1000. The reason for choosing 500 is to ensure that the sum of the associated document from the Bulk.find() and the update document is less than or equal to the maximum BSON document size even though there is no there is no guarantee using the default 1000 operations requests will fit under the 16MB BSON limit. Th

C:\WINDOWS\system32\config\systemprofile\Desktop Is Not Accessible?

Answer : This is caused by the desktop reverting to a mandatory login profile, being caused by a new file in your user directory labelled ntuser.man, and has happened to me twice while doing Windows updates. Simply rename this file to something else and login. The trick is getting access to this file to rename it. The best way is to do it is from another administrator account. The file is: c:\users\<profilename>\ntuser.man Change it to: c:\users\<profilename>\ntuser.m.a.n.safe (or anything else)

Can LINQ Be Used In PowerShell?

Answer : The problem with your code is that PowerShell cannot decide to which specific delegate type the ScriptBlock instance ( { ... } ) should be cast. So it isn't able to choose a type-concrete delegate instantiation for the generic 2nd parameter of the Where method. And it also does't have syntax to specify a generic parameter explicitly. To resolve this problem, you need to cast the ScriptBlock instance to the right delegate type yourself: $data = 0..10 [System.Linq.Enumerable]::Where($data, [Func[object,bool]]{ param($x) $x -gt 5 }) Why does [Func[object, bool]] work, but [Func[int, bool]] does not? Because your $data is [object[]] , not [int[]] , given that PowerShell creates [object[]] arrays by default; you can, however, construct [int[]] instances explicitly: $intdata = [int[]]$data [System.Linq.Enumerable]::Where($intdata, [Func[int,bool]]{ param($x) $x -gt 5 }) To complement PetSerAl's helpful answer with a broader answer to match the qu

2D Peak Finding Algorithm In O(n) Worst Case Time?

Answer : Let's assume that width of the array is bigger than height, otherwise we will split in another direction. Split the array into three parts: central column, left side and right side. Go through the central column and two neighbour columns and look for maximum. If it's in the central column - this is our peak If it's in the left side, run this algorithm on subarray left_side + central_column If it's in the right side, run this algorithm on subarray right_side + central_column Why this works: For cases where the maximum element is in the central column - obvious. If it's not, we can step from that maximum to increasing elements and will definitely not cross the central row, so a peak will definitely exist in the corresponding half. Why this is O(n): step #3 takes less than or equal to max_dimension iterations and max_dimension at least halves on every two algorithm steps. This gives n+n/2+n/4+... which is O(n) . Important detail: we split

Private Protected Php Code Example

Example: how to access private and protected members in php < ? php class GrandPa { protected $name = 'Mark Henry' ; } class Daddy extends GrandPa { function displayGrandPaName ( ) { return $ this -> name ; } } $daddy = new Daddy ; echo $daddy -> displayGrandPaName ( ) ; // Prints 'Mark Henry' $outsiderWantstoKnowGrandpasName = new GrandPa ; echo $outsiderWantstoKnowGrandpasName -> name ; // Results in a Fatal Error