This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static public List<Integer> common_divisor(int n) { | |
List<Integer> result = new ArrayList(); | |
for (int i=2; i<=Math.sqrt(n); i++) | |
{ | |
// if 'i' is factor of n | |
if (n%i==0) | |
{ | |
// check if divisors are equal | |
if (n/i == i) | |
result.add(i); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// recursive implementation | |
public static int gcd(int p, int q) { | |
if (q == 0) return p; | |
else return gcd(q, p % q); | |
} | |
// non-recursive implementation | |
public static int gcd2(int p, int q) { | |
while (q != 0) { | |
int temp = q; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
level = {-1:0} | |
level[l] = level[l-1] + len(lentry) + 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// an example to create a new mapping `ctrl-y` | |
mapkey('<Ctrl-y>', 'Show me the money', function() { | |
Front.showPopup('a well-known phrase uttered by characters in the 1996 film Jerry Maguire (Escape to close).'); | |
}); | |
// an example to replace `u` with `?`, click `Default mappings` to see how `u` works. | |
map('?', 'u'); | |
map('u', 'e'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Emacs Keybindings | |
imap <C-n> forwardLine | |
imap <C-p> backwardLine | |
imap <C-f> forwardChar | |
imap <C-b> backwardChar | |
imap <M-f> forwardWord | |
imap <M-b> backwardWord | |
imap <C-a> beginningOfLine | |
imap <C-e> endOfLine | |
imap <C-k> deleteToEnd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ 19.349] | |
X.Org X Server 1.19.3 | |
Release Date: 2017-03-15 | |
[ 19.349] X Protocol Version 11, Revision 0 | |
[ 19.349] Build Operating System: Linux 4.9.11-1-ARCH x86_64 | |
[ 19.349] Current Operating System: Linux ZT-alienware 4.9.25-1-lts #1 SMP Thu Apr 27 16:42:36 CEST 2017 x86_64 | |
[ 19.349] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-linux-lts root=UUID=38cca7ab-2d9e-4503-87fd-d8f1ea4e02ce rw quiet resume=UUID=a365d2e5-57af-472d-b39e-e52da5e88de4 | |
[ 19.349] Build Date: 07 April 2017 05:42:48PM | |
[ 19.349] | |
[ 19.349] Current version of pixman: 0.34.0 |