Skip to content

Instantly share code, notes, and snippets.

@r888888888
r888888888 / keybase.md
Created March 12, 2020 17:10
keybase.md

Keybase proof

I hereby claim:

  • I am r888888888 on github.
  • I am albertyi (https://keybase.io/albertyi) on keybase.
  • I have a public key ASBeq36ZpVKIgsgOUrl4GrcZDCcoTqnq0kC7WoCFvejaVgo

To claim this, I am signing this object:

@r888888888
r888888888 / automod.py
Created May 1, 2019 01:23
automod training script
import boto3
from sklearn.ensemble import RandomForestClassifier
import numpy as np
import pprint
from sklearn.model_selection import train_test_split, cross_val_score
import pickle
import os
fields = {
'artist_count': lambda x: get_number(x['artist_count']),
@r888888888
r888888888 / fancy.js
Created February 8, 2019 01:26
fancy js
const breakpoints = {
phone: 0,
tablet: 769,
laptop: 1281,
desktop: 1681,
large: 1921
};
const mq = Object.keys(breakpoints).reduce((obj, key) => {
Object.assign(obj, { [key]: `@media (min-width: ${breakpoints[key]}px)` });
import numpy as np
def f(x):
return 0.2 * x + 20
def predict(inputs, weights):
return np.dot(inputs, weights[1:]) + weights[0]
def activate(x):
return np.where(x >= 0.0, 1, 0)
import random
import numpy as np
import matplotlib.pyplot as plt
def f(x):
return 2 * x
def predict(inputs, weights):
return np.dot(inputs[1:], weights[1:]) + weights[0]
import random
import numpy as np
import matplotlib.pyplot as plt
def f(x):
return x * 0.5
def predict(inputs, weights):
return np.dot(inputs, weights)
@r888888888
r888888888 / perceptron.py
Created August 9, 2018 23:00
perceptron
import random
import numpy as np
import matplotlib.pyplot as plt
def f(x):
return x * 0.5
def predict(inputs, weights):
return np.dot(inputs, weights)
tag alias naruenosekai -> narue_no_sekai retired
tag alias gokujoseitokai -> gokujou_seitokai retired
tag alias wf2k5 -> wonder_festival_2005 retired
tag alias chokottosister -> chokotto_sister retired
tag alias ginbankaleidoscope -> ginban_kaleidoscope retired
tag alias shikigaminoshiro -> shikigami_no_shiro retired
tag alias magicalantique -> magical_antique retired
tag alias pspwallpaper -> psp_wallpaper retired
tag alias ultimate_girls -> ultimate_girl retired
tag alias ultimategirl -> ultimate_girl retired
There is a joke I like that goes
A professor of mathematics noticed that his kitchen sink at his home leaked. He called a plumber.
The plumber came the next day and sealed a few screws, and everything was working as before.
The professor was delighted. However, when the plumber gave him the bill a minute later, he was
shocked.
"This is one-third of my monthly salary!" he yelled.
Well, all the same he paid it and then the plumber said to him, "I understand your position as a
@r888888888
r888888888 / flatten.py
Last active January 10, 2018 05:54
flatten
def f(x, acc=[]):
if isinstance(x, int):
acc.append(x)
else:
[f(y, acc) for y in x]
return acc
print(f([1,2,3]))
print(f([1,[2,2],[3,[4]]]))