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
#!/usr/bin/python | |
import re | |
from urllib import parse | |
from wsgiref import simple_server | |
def application(env, start_response): | |
start_response('200 OK', [ | |
('Content-type', 'text/plain'), | |
('Access-Control-Allow-Origin', 'http://localhost:8080') |
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
$ /usr/bin/time -f "Memory:%M KB time:%E" ls -alh | |
... | |
Memory:3568 KB time:0:00.01 |
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
let obj1 = {'key1': 10, 'key2': 20, 'key3': 30, 'key4': 40} | |
let obj2 = {'key1': 10, 'key3': 30, 'key4': 40} | |
if (['key1', 'key3', 'key4'].every(key => obj1[key] === obj2[key])) { | |
console.log('all specified values are same'); | |
} else { | |
console.log('different values were found'); | |
} | |
// all specified values are same |
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
class A(NamedTuple): | |
a1: int | |
a2: str | |
a3: str | |
a4: int | |
class B(NamedTuple): | |
a1: int | |
a3: str |
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
import functools | |
import operator | |
r = functools.reduce(operator.mul, range(1,5)) | |
# r = 24 |
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
def convert_one_hot(val, vocab_size): | |
if isinstance(val, (list, )): | |
return [convert_one_hot(v, vocab_size) for v in val] | |
base = [0] * vocab_size | |
base[val] = 1 | |
return base |
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
#---------- python2 ---------- | |
#!/usr/bin/python | |
from wsgiref import simple_server | |
def application(env, start_response): | |
start_response('200 OK', [('Content-type', 'text/plain')]) | |
s = '' |
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
[ 0.000000] Booting Linux on physical CPU 0x0 | |
[ 0.000000] Initializing cgroup subsys cpuset | |
[ 0.000000] Initializing cgroup subsys cpu | |
[ 0.000000] Initializing cgroup subsys cpuacct | |
[ 0.000000] Linux version 4.4.24-3-default (geeko@buildhost) (gcc version 6.2.1 20160830 [gcc-6-branch revision 239856] (SUSE Linux) ) #1 SMP Wed Oct 12 14:23:39 UTC 2016 (1288c77) | |
[ 0.000000] Boot CPU: AArch64 Processor [410fd034] | |
[ 0.000000] Getting EFI parameters from FDT: | |
[ 0.000000] EFI v2.05 by Das U-boot | |
[ 0.000000] efi: efi: SMBIOS=0x35b14000 efi: | |
[ 0.000000] No NUMA configuration found |
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
<?php | |
class A { | |
public function response() { | |
echo "this is class A", "\n"; | |
} | |
} |
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
class Succ { | |
public static void main(String[] argv) { | |
int a = 1; | |
int b = 3; | |
System.out.println(a+b); | |
System.out.println(succ(a)); | |
} | |
private static int succ(int x) { | |
return x + 1; |