Skip to content

Instantly share code, notes, and snippets.

@upepo
upepo / .vimrc
Created April 17, 2020 18:02 — forked from simonista/.vimrc
A basic .vimrc file that will serve as a good template on which to build.
" Don't try to be vi compatible
set nocompatible
" Helps force plugins to load correctly when it is turned back on below
filetype off
" TODO: Load plugins here (pathogen or vundle)
" Turn on syntax highlighting
syntax on
@upepo
upepo / pg-pong.py
Created December 6, 2016 10:03 — forked from karpathy/pg-pong.py
Training a Neural Network ATARI Pong agent with Policy Gradients from raw pixels
""" Trains an agent with (stochastic) Policy Gradients on Pong. Uses OpenAI Gym. """
import numpy as np
import cPickle as pickle
import gym
# hyperparameters
H = 200 # number of hidden layer neurons
batch_size = 10 # every how many episodes to do a param update?
learning_rate = 1e-4
gamma = 0.99 # discount factor for reward
import pandas as pd
def get_nominal_integer_dict(nominal_vals):
d = {}
for val in nominal_vals:
if val not in d:
current_max = max(d.values()) if len(d) > 0 else -1
d[val] = current_max+1
return d
@upepo
upepo / byteReverse.py
Created April 29, 2015 01:00
python long to reverse byte
def byteReverse(long_key):
a = long('{:064b}'.format(long(long_key))[::-1],2)
b = bytearray.fromhex('{:016x}'.format(a))
return bytes(b)
# Requires ImageMagick
# Converting the source from JPEG to PNG - if necessary
convert my_src_image.jpg my_src_image.png
# Option A
# - Requires a temporary intermediate file
# - Drill more than 10 might result in poor results
{
"IAB1": "Arts & Entertainment",
"IAB1-1": "Books & Literature",
"IAB1-2": "Celebrity Fan/Gossip",
"IAB1-3": "Fine Art",
"IAB1-4": "Humor",
"IAB1-5": "Movies",
"IAB1-6": "Music",
"IAB1-7": "Television",
"IAB2": "Automotive",
@upepo
upepo / random_sample.py
Created January 13, 2015 05:10
random sampling
#!/usr/bin/env python
import sys
import random
import argparse
parser = argparse.ArgumentParser(description='')
parser.add_argument('--ratio','-r', type=float, nargs='?'
,required=True
,help='ratio for random sampling')

2015

2015/01/13

  • The Internet of Things has four big data problems : 데이터가 파편화. 데이터가 많지만 한회사가 전체를 가지고 분석하기는 힘들걸? 그래서 inference도 더 필요하고, 데이터가지고 아전인수격의 결론도 많이 낼거다. (센싱데이터의 거래소가 생길까?...)
    1. Nobody will wear 50 devices
@upepo
upepo / display.md
Last active August 29, 2015 14:07
전시
@upepo
upepo / hive
Last active August 29, 2015 14:07
hive memo
hive memo
String functions in hive
- http://www.folkstalk.com/2011/11/string-functions-in-hive.html