Skip to content

Instantly share code, notes, and snippets.

@kyroskoh
kyroskoh / nginx.conf
Created July 1, 2016 08:47 — forked from fightingtheboss/nginx.conf
Nginx configuration file for private VPN deployment of a Meteor app with HAProxy handling load balancing
upstream haproxy {
server 127.0.0.1:9000;
}
upstream stats {
server 127.0.0.1:9999;
}
server {
listen 80; ## listen for ipv4; this line is default and implied
@kyroskoh
kyroskoh / haproxy.cfg
Created July 1, 2016 08:47 — forked from fightingtheboss/haproxy.cfg
HAProxy configuration file for deploying Meteor application to private VPN. Fronted by nginx for static assets, backed by multiple app instances. See https://gist.github.com/fightingtheboss/5843323 for Nginx setup.
global
daemon
defaults
mode http
timeout connect 86400000
timeout server 86400000
timeout client 86400000
timeout check 5s
@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}"

This Bot is based on NadekoBot

#KyrosBot List Of Commands
Version: NadekoBot v0.9.6030.3793

Help

Command and aliases Description Usage
-h, -help, @BotName help, @BotName h, ~h Either shows a help for a single command, or PMs you help link if no arguments are specified. '-h !m q' or just '-h'
-hgit Generates the commandlist.md file. Bot Owner Only!
-readme, -guide Sends a readme and a guide links to the channel.
@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 / 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 / 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 / Tangram Play
Created July 26, 2016 05:20
Tangram Play
{
"url": "https://api.github.com/gists/ca0ad8cd45ffbabf46e98561c3dd4634",
"forks_url": "https://api.github.com/gists/ca0ad8cd45ffbabf46e98561c3dd4634/forks",
"commits_url": "https://api.github.com/gists/ca0ad8cd45ffbabf46e98561c3dd4634/commits",
"id": "ca0ad8cd45ffbabf46e98561c3dd4634",
"git_pull_url": "https://gist.github.com/ca0ad8cd45ffbabf46e98561c3dd4634.git",
"git_push_url": "https://gist.github.com/ca0ad8cd45ffbabf46e98561c3dd4634.git",
"html_url": "https://gist.github.com/ca0ad8cd45ffbabf46e98561c3dd4634",
"files": {
".tangramplay": {
@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()))