Skip to content

Instantly share code, notes, and snippets.

@kyroskoh
kyroskoh / index.html
Created November 7, 2016 05:39 — forked from AlcaDesign/index.html
An almost complete tmi.js example (browser)
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Chat</title>
<link href='http://fonts.googleapis.com/css?family=Roboto:400,700,300' rel='stylesheet' type='text/css'>
<link href="style.css" rel="stylesheet" type="text/css">
<script src="https://d2g2wobxbkulb1.cloudfront.net/0.0.19/tmi.js"></script> <!--For developement-->
<!--<script src="https://d2g2wobxbkulb1.cloudfront.net/0.0.19/tmi.min.js"></script>--> <!--For "production"-->
</head>
@kyroskoh
kyroskoh / Gemfile
Created September 27, 2016 02:18 — forked from carlosgaldino/Gemfile
Copy objects from multiple S3 buckets to another.
source 'https://rubygems.org'
gem 'aws-sdk', '~> 1.30.1'
@kyroskoh
kyroskoh / S3 buckets copy.md
Created September 26, 2016 10:13 — forked from ushu/S3 buckets copy.md
Copy between S3 buckets w/ different accounts

This is a mix between two sources:

basically the first resource is great but didn't work for me: I had to remove the trailing "/*" in the resource string to make it work. I also noticed that setting the policy on the source bucket was sufficient. In the end these are the exact steps I followed to copy data between two buckets on two accounts

Basically the idea there is:

  • we allowe the destination account to read the source bucket (in the console for the source account)
  • we log as the destination and start the copy
@kyroskoh
kyroskoh / GAME_MASTER_v0_1.protobuf
Created August 14, 2016 14:28 — forked from anonymous/GAME_MASTER_v0_1.protobuf
Pokemon Go decoded GAME_MASTER protobuf file v0.1
Result: 1
Items {
TemplateId: "BADGE_BATTLE_ATTACK_WON"
Badge {
BadgeType: BADGE_BATTLE_ATTACK_WON
BadgeRanks: 4
Targets: "\nd\350\007"
}
}
Items {
@kyroskoh
kyroskoh / foursquare_extract.py
Created August 2, 2016 03:22 — forked from FloorLamp/foursquare_extract.py
Foursquare data extraction
from collections import defaultdict
import datetime
import requests
import time
CHECKINS_API = 'https://api.foursquare.com/v2/users/self/checkins'
CATEGORIES_API = 'https://api.foursquare.com/v2/venues/categories'
YEAR_BEGIN = int(time.mktime(datetime.date(2013,1,1).timetuple()))
YEAR_END = int(time.mktime(datetime.date(2014,1,1).timetuple()))
WEEK = int(time.mktime(datetime.date(2013,12,29).timetuple()))
@kyroskoh
kyroskoh / nginx.conf
Created July 25, 2016 07:05 — forked from leandromoreira/nginx.conf
nginx.conf optmized for http/2 = HTTPS TLS (ssl)
# command to generate dhparams.pen
# openssl dhparam -out /etc/nginx/conf.d/dhparams.pem 2048
limit_conn_zone $binary_remote_addr zone=conn_limit_per_ip:10m;
limit_req_zone $binary_remote_addr zone=req_limit_per_ip:10m rate=5r/s;
limit_req_status 444;
limit_conn_status 503;
proxy_cache_path /var/lib/nginx/proxy levels=1:2 keys_zone=backcache:8m max_size=50m;
proxy_cache_key "$scheme$request_method$host$request_uri$is_args$args";
@kyroskoh
kyroskoh / cors-nginx.conf
Created July 15, 2016 06:13 — forked from alexjs/cors-nginx.conf
Slightly tighter CORS config for nginx
#
# Slightly tighter CORS config for nginx
#
# A modification of https://gist.github.com/1064640/ to include a white-list of URLs
#
# Despite the W3C guidance suggesting that a list of origins can be passed as part of
# Access-Control-Allow-Origin headers, several browsers (well, at least Firefox)
# don't seem to play nicely with this.
#
@kyroskoh
kyroskoh / cors-nginx.conf
Created July 15, 2016 06:11 — forked from Ry4an/cors-nginx.conf
Here' the minimal Access-Control-Allow-Origin header insertion necessary to allow any whitelisted sites to access resources via CORS headers.
#
# Minimal CORS config for nginx
#
# A modification of https://gist.github.com/alexjs/4165271
#
# NB: This relies on the use of the 'Origin' HTTP Header.
location /static {
if ($http_origin ~* (whitelist\.address\.one|whitelist\.address\.two)$) {
@kyroskoh
kyroskoh / deploy.rb
Created July 1, 2016 08:48 — forked from fightingtheboss/deploy.rb
Capistrano deploy script for deploying multiple app instances of a Meteor app to a single private VPS on different ports.
# This deploy script takes a parameter to define the number of instances to deploy (default is 1)
# ex: cap deploy -s instances=3
set :application, "YOUR_APP_NAME"
set :repository, "git@YOUR_GIT_REPOT.git"
set :scm, :git
set :deploy_via, :remote_cache
set :user, "deploy"
set :deploy_to, "/home/deploy/www/#{application}"