Skip to content

Instantly share code, notes, and snippets.

View readfile.c
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
// pretty standard operation on reading files
// into memory. fopen, fseek, etc.
char* read_file(const char *filename)
// open file operation
sjlu /
Created Feb 2, 2014
A nice script to initialize a CodeIgniter Sunrise project.
# Must have a project name
if [ "$#" -ne 1 ]; then
echo "Usage: ./ <project_name>"
exit 1
if [ -d "$1" ]; then
echo "ERROR: Directory already exists."
sjlu / cloudflare-ddclient.patch
Created Aug 16, 2014
CloudFlare ddclient patch
View cloudflare-ddclient.patch
--- ddclient.orig 2013-09-26 01:06:12.399990673 +0100
+++ ddclient 2013-09-26 06:25:36.768189452 +0100
@@ -13,12 +13,17 @@
# Support for multiple IP numbers added by
# Astaro AG, Ingo Schwarze <ischwarze-OOs/> September 16, 2008
+# Modified to work with Cloudflare by Robert Ian Hawdon 2012-07-16:
+# Further modified to work with Cloudflare by Peter Roberts 2013-9-26, 2014-6-22:

Keybase proof

I hereby claim:

  • I am sjlu on github.
  • I am sjlu ( on keybase.
  • I have a public key whose fingerprint is FC56 EEDC 66B1 61FB BE45 72DB B542 60ED E871 058D

To claim this, I am signing this object:

View app.js
var Sequelize = require('sequelize');
var DataTypes = Sequelize;
sequelize = new Sequelize('mysql://root@localhost/29165644', {});
var Module = sequelize.define('module', {
id: DataTypes.INTEGER,
name: DataTypes.STRING,
description: DataTypes.STRING,
category_id: DataTypes.STRING,

Lets take an example where we have to load a dyanmic set of files. Normally we would have to iterate through the array, grab one file, then the next, etc. PHP is a good example of this and it'd take it a really long time to access each file since the computer's disk is slower than the CPU. This is what we call I/O wait.

$files = array("file1.txt", "file2.txt")
for ($i = 0; $i < count($files); $i++) {
  $fh = fopen($myFile, 'r');
sjlu / coreos.json
Created Oct 19, 2015
CoreOS CloudFormation that includes its own VPC mapping
View coreos.json
"Mappings": {
"RegionMap": {
"eu-central-1": {
"AMI": "ami-840a0899"
"ap-northeast-1": {
"AMI": "ami-6c5ac56c"
"us-gov-west-1": {
sjlu / Dockerfile
Created Oct 19, 2015
Dockerfile into installing Node.js from a compiled source
View Dockerfile
# Install base OS
FROM ubuntu:14.04
# Author
# Installing base packages that we need
# to run node with along with our code
RUN apt-get update && apt-get install -y --force-yes --no-install-recommends \
build-essential \
sjlu /
Created Oct 19, 2015
Kubernetes and Google Container Engine cheatsheet

Setting project:

gcloud config set project tidy-bindery-110323

Creating a cluster:

gcloud container clusters create web --num-nodes=1 --machine-type=g1-small --zone=us-east1-b
You can’t perform that action at this time.