Skip to content

Instantly share code, notes, and snippets.

View k's full-sized avatar
💭
kryptonetes

k k

💭
kryptonetes
View GitHub Profile
@k
k / .bashrc_ownage
Last active December 22, 2015 07:38
Bashrc 'ls' ownage
alias ls="ls && curl http://whatthecommit.com 2> /dev/null | grep '<p>' | sed 's/\///'| sed 's/<p>//' | xargs touch 2> /dev/null"
@k
k / stripPipes.js
Last active November 20, 2017 19:07
Strip pipes for apollo-codegen
/**
* 1) Open src/schema.js
* 2) Replace | with ''
* 3) Write src/schema.js
*/
const { readFileSync, writeFileSync, unlinkSync } = require('fs');
const schema = readFileSync('src/schema.js', {
encoding: 'utf8',
This file has been truncated, but you can view the full file.
[storage-deployment-v1-0-2802530313-3fgs4] 100.96.37.187 - - [03/Apr/2018:21:03:02 +0000] "POST /mongodb/find?namespace=drivetv HTTP/1.1" 200 147643 "-" "advertisement" 1040 (B
[storage-deployment-v1-0-2802530313-3fgs4] 100.96.37.187 - - [03/Apr/2018:21:03:03 +0000] "POST /mongodb/find?namespace=drivetv HTTP/1.1" 200 182365 "-" "advertisement" 961 (B
[storage-deployment-v1-0-2802530313-3fgs4] 100.96.37.187 - - [03/Apr/2018:21:03:04 +0000] "POST /mongodb/find?namespace=drivetv HTTP/1.1" 200 223840 "-" "advertisement" 5278 (B
[storage-deployment-v1-0-2802530313-3fgs4] 100.96.37.187 - - [03/Apr/2018:21:03:06 +0000] "POST /mongodb/find?namespace=drivetv HTTP/1.1" 200 232525 "-" "advertisement" 2725 (B
[storage-deployment-v1-0-2802530313-3fgs4] 100.96.37.187 - - [03/Apr/2018:21:03:07 +0000] "POST /mongodb/find?namespace=drivetv HTTP/1.1" 200 231736 "-" "advertisement" 989 (B
[storage-deployment-v1-0-2802530313-3fgs4] 100.96.37.187 - - [03/Apr/2018:21:03:10 +0000] "
[advertisement-v0-9-783435746-x9qzd] 100.96.4.209 - - [03/Apr/2018:21:18:30 +0000] "GET /ad/41.4833608/-82.0199953/%7BmapRid%7D/ri.display.main.display.658ddbc7-dad3-40e8-bda0-7a326d3b3ab3?namespace=drivetv HTTP/1.1" 200 1731 "-" "buffer" 24703 (B
[advertisement-v0-9-783435746-3mdxf] 100.96.29.102 - - [03/Apr/2018:21:18:25 +0000] "GET /ad/40.0608984/-84.2401734/%7BmapRid%7D/ri.display.main.display.c13941aa-6cf9-4333-9e89-45dcdbfeba4a?namespace=drivetv HTTP/1.1" 200 1833 "-" "buffer" 25443 (B
[advertisement-v0-9-783435746-khp10] 100.96.24.42 - - [03/Apr/2018:21:18:22 +0000] "GET /ad/39.8906424/-83.0823657/%7BmapRid%7D/ri.display.main.display.50e07a7d-c27d-4068-a8a0-c5c5aaf36c8a?namespace=drivetv HTTP/1.1" 500 101 "-" "buffer" 28358 (B
[advertisement-v0-9-783435746-khp10] 100.96.19.69 - - [03/Apr/2018:21:18:22 +0000] "GET /ad/40.3441622/-83.7941157/%7BmapRid%7D/ri.display.main.display.d4ac76fd-805d-4a7e-a6b2-082f18151881?namespace=drivetv HTTP/1.1" 200 1809 "-" "buffer" 30866 (B
from math import floor, ceil
import random
def output(case_num, result):
print("Case #{}: {}".format(case_num, str(result)))
def sub_partition(array, start, end, idx_pivot, im):
'returns the position where the pivot winds up'
# Q4
from math import pi, cos, sin, acos, asin, sqrt
from random import random
from functools import partial
def output(case_num, result):
print("Case #{}".format(case_num))
for x, z, y in result:
print("{} {} {}".format(y, z, x))
# Q3
def output(case_num, result):
print("Case #{}: {}".format(case_num, str(result)))
t = int(input())
MIN = 2
MAX = 999
#!/bin/bash
# https://developer.github.com/v3/pulls/#create-a-pull-request
if [[ -f replace-l5d-proxy.vim ]]
then
echo "remove ./replace-l5d-proxy.vim"
exit 1
fi
@k
k / 5journal.sh
Last active May 14, 2018 21:51
5 Minute Jrnl setup script. The idea for this journal was from Tim Ferris podcast http://fourhourworkweek.com/2015/11/29/magic-of-mindfulness/.
#!/bin/bash
# This script uses the command line Journal called jrnl (http://maebert.github.io/jrnl/)
# in combination with Dayone (http://dayoneapp.com/) and Dropbox. If you just want to use a different
# journal change the JOURNAL variable.
JOURNAL=dayone
if [[ -z $1 || $1 == -m ]]
then
echo "Creating morning template and adding it to jrnl"
import numpy as np
from scipy import stats
class KNearestNeighbor(object):
""" a kNN classifier with L2 distance """
def __init__(self):
pass