Skip to content

Instantly share code, notes, and snippets.

const jar = {}
function canonical(path) {
// remove trailing slash
if (path[path.length - 1] === '/') {
path = path.substring(0, path.length - 1)
}
return path
}
@comfuture
comfuture / kakao.ipynb
Created September 29, 2017 02:53
카카오 공채 문제풀이
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@comfuture
comfuture / sms
Last active September 13, 2017 01:19
#!/usr/bin/osascript
on run argv
set nr to item 1 of argv
set msg to item 2 of argv
tell application "System Events"
tell application "Messages" to activate
end tell
tell application "Messages"
from threading import Thread
try:
import gevent
except ImportError:
pass
def async(fn):
def decorator(*args, **kwargs):
# if use_greenlet:
gevent.spawn(fn, *args, **kwargs)
PING ec2-52-79-42-106.ap-northeast-2.compute.amazonaws.com (52.79.42.106): 56 data bytes
64 bytes from 52.79.42.106: icmp_seq=0 ttl=47 time=15.730 ms
64 bytes from 52.79.42.106: icmp_seq=1 ttl=47 time=10.836 ms
64 bytes from 52.79.42.106: icmp_seq=2 ttl=47 time=10.514 ms
64 bytes from 52.79.42.106: icmp_seq=3 ttl=47 time=12.312 ms
^C
--- ec2-52-79-42-106.ap-northeast-2.compute.amazonaws.com ping statistics ---
4 packets transmitted, 4 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 10.514/12.348/15.730/2.067 ms
comfuture:~ comfuture$ traceroute ec2-52-79-42-106.ap-northeast-2.compute.amazonaws.com
import subprocess
def df():
proc = subprocess.Popen(['df','/'], stdout=subprocess.PIPE)
output = proc.communicate()[0]
for line in output.split('\n')[1:]:
yield line.split()[:5]
print list(df())
This file has been truncated, but you can view the full file.
[{"weight":[[[[-0.0384068377316,-0.13892742991447,-0.074116952717304],[-0.0043417760170996,-0.13482336699963,-0.05335071310401],[0.094891287386417,0.13990740478039,0.21070368587971]]],[[[0.13741871714592,0.068341165781021,-0.049014247953892],[0.0052761328406632,-0.020446205511689,0.047407131642103],[-0.018339443951845,-0.027100933715701,-0.0057863597758114]]],[[[0.17850013077259,0.051763921976089,-0.0062319315038621],[-0.019090188667178,-0.055008850991726,-0.14032724499702],[-0.051505457609892,-0.099252879619598,0.14686788618565]]],[[[0.011584693565965,0.041832812130451,0.22183129191399],[-0.017042856663465,-0.095366142690182,0.044966705143452],[-0.001104052294977,0.0075620785355568,-0.017687179148197]]],[[[0.056010495871305,-0.014734433032572,-0.0077268448658288],[-0.0037417802959681,0.049426376819611,0.011491533368826],[0.20122179389,-0.038716461509466,0.001358984853141]]],[[[-0.11974314600229,-0.096629768610001,0.022501574829221],[-0.15950687229633,0.016204258427024,-0.0048143183812499],[-0.005881851539015
db.report.aggregate([
{'$match': {
'date': {'$gte': yesterday}
}},
{'$group': {
'_id': {
'$let': {
'vars': {
'local_date': {'$add': ['$date', 9 * 60 * 60 * 1000]}
},
class Layout
###
> Layout.arrange('.home', {'bottom': 10})
// arrange all '.home' to bottom of their parent element
> Layout.arrange('.home', {'bottom': 10}).watch()
// arrange and monitor window resizing
> $('.home').arrange({'bottom': 30}).watch()
// using jquery direct
> $('.half').arrange({'height': '50%'}).watch();
def xxrange(start, stop, step=1):
cur = start
while cur < stop:
yield cur
cur += step
locs = reversed([(lat, lng) for lat in xxrange(18.0, 64.0, 0.1) \
for lng in xxrange(-124.0, -66.0, 0.1) if lat is not lng])
for i, loc in enumerate(locs):