Skip to content

Instantly share code, notes, and snippets.

View raykao's full-sized avatar
🇨🇦
¯\_(ツ)_/¯

Raymond Kao raykao

🇨🇦
¯\_(ツ)_/¯
View GitHub Profile

Digital Ocean recently released private networking support in their NYC2 Data center.

They also published a blog post on how to setup a new droplet with private networking. But one thing the post doesn't do is tell you how to scale your private network for many boxes. One approach is obviously to edit /etc/hosts (but this gets annoying when you add a new box). A better way is to create an internal DNS zone (via the digital ocean web interface) and have your droplets use it:

Steps

setup the internal DNS zone file

  1. Login to digital ocean
  2. Click "DNS" on the right hand menu
@raykao
raykao / sublime as default editor for ubuntu.md
Last active April 28, 2018 13:07
How to add sublime as the default editor on Ubuntu
sudo mv Sublime\ Text\ 2 /opt/
sudo ln -s /opt/Sublime\ Text\ 2/sublime_text /usr/bin/sublime
sudo sublime /usr/share/applications/sublime.desktop

Copy/Paste to file

[Desktop Entry]
Version=1.0
@raykao
raykao / grunt-connect-rewrite-ember.js
Created December 21, 2013 20:40
Grunt-connect-rewrite config for Ember Apps. This config settings is for use in Development using grunt-contrib-connect and setting Router location property to history (location: 'history')
options: {
port: 9000,
// change this to '0.0.0.0' to access the server from outside
hostname: 'localhost'
},
rules: [
// Internal rewrite
{from: '(^((?!css|html|js|images|fonts|\/$).)*$)', to: '/index.html#$1'}
],
dev: {
@raykao
raykao / jquery_to_console.js
Created January 23, 2014 02:36
add jquery to console
var jq = document.createElement('script');
jq.src = '//code.jquery.com/jquery-2.0.3.min.js';
class Api::RegistrationsController < Api::BaseController
respond_to :json
def create
user = User.new(params[:user])
if user.save
render :json=> user.as_json(:auth_token=>user.authentication_token, :email=>user.email), :status=>201
return
else
@raykao
raykao / DevTO Appy Hour April 23rd 2014.md
Last active August 29, 2015 14:00
#DevTO Appy Hour April 23rd 2014
@raykao
raykao / accelerometer_tilt.ino
Created June 27, 2014 14:44
Intro To Wearable Computing Workshop
int groundpin = 18; // analog input pin 4
int powerpin = 19; // analog input pin 5
int xpin = A3; // x-axis of the accelerometer
int ypin = A2; // y-axis
int zpin = A1; // z-axis (only on 3-axis models)
long xy_max = 470;
long xy_min = 550;
int forwardPin = 9;
int backPin = 10;
@raykao
raykao / vsftpd.conf
Created August 7, 2014 13:33
Conf file for vsftpd setup. Resolves issues with servers behind a nat. chroots users to their homedirs
listen=YES
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
use_localtime=YES
xferlog_enable=YES
connect_from_port_20=YES
chroot_local_user=YES
@raykao
raykao / safety_vest.ino
Created August 15, 2014 17:01
Code to make your own blinking turn light tilt sensor safety vest
int groundpin = 18; // analog input pin 4
int powerpin = 19; // analog input pin 5
int xpin = A3; // x-axis of the accelerometer
int ypin = A2; // y-axis
int zpin = A1; // z-axis (only on 3-axis models)
long xy_max = 500;
long xy_min = 540;
int leftPin = 11;
int rightPin = 8;
#
# Wide-open CORS config for nginx
#
location / {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
#