Skip to content

Instantly share code, notes, and snippets.

@simkimsia
simkimsia / setup-webapp-in-nginx.sh
Last active December 11, 2015 02:08
A simple bash script to create two instances for your webapp in nginx. The first is stage.webapp.com. The second is webapp.com. Usually put in /var/virtual
#!/bin/bash
###
#
# Copyright (c) 2013 KimSia Sim
#
# Ubuntu 12.10 based make directories in /var/virtual for webapp.com
# Run this by executing the following from a fresh install of Ubuntu 12.10 server:
#
# bash -c "$(curl -fsSL https://raw.github.com/gist/4528222)" <webapp.com>
@simkimsia
simkimsia / changeshell.sh
Last active December 14, 2015 18:09
change shell for any user to use /bin/bash
#!/usr/bin/expect -f
###
#
# Copyright (c) 2013 KimSia Sim
#
# Ubuntu 12.10 based change shell for users
# Run this by executing the following from a fresh install of Ubuntu 12.10 server:
#
# expect -c "$(curl -fsSL https://raw.github.com/gist/5126919)" <username> <password>
@simkimsia
simkimsia / install_Phing_d51PearPkg2Task.sh
Created March 11, 2013 11:36
install Phing_d51PearPkg2Task for phing commands
#!/bin/bash
###
#
# Ubuntu 12.10 based web server installation script for Phing_d51PearPkg2Task
# because the pear.domain51.com channel is down
# Run this by executing the following from a fresh install of Ubuntu 12.10 server:
#
# bash -c "$(curl -fsSL https://raw.github.com/gist/4372049)"
#
@simkimsia
simkimsia / npm-debug.log
Created March 23, 2013 08:30
my npm-debug.log for issue #3275 for npm https://github.com/isaacs/npm/issues/3275
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'install' ]
2 info using npm@1.2.10
3 info using node@v0.9.10-pre
4 verbose read json /var/virtual/storyzer.com/LearnBackboneLayoutManager/package.json
5 warn package.json learnbackbonelayoutmanager@0.0.0 No README.md file found!
6 verbose readDependencies using package.json deps
7 verbose install where, deps [ '/var/virtual/storyzer.com/LearnBackboneLayoutManager',
7 verbose install [ 'grunt',
7 verbose install 'grunt-contrib-copy',
@simkimsia
simkimsia / jenkins-nginx.conf
Last active December 15, 2015 18:59
a nginx config file you place in sites-available so that you can access your jenkins via ci.example.com
server {
listen 80;
server_name ci.example.com;
location / {
proxy_pass http://localhost:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
@simkimsia
simkimsia / install-mongodb.sh
Last active December 15, 2015 20:09
install mongodb on ubuntu 12.10 server
#!/bin/bash
###
#
# forked from https://gist.github.com/1264701/08f93534ba177f173b9382b53c419cd0de5b07ea
# Copyright (c) 2011 Cake Development Corporation (http//cakedc.com)
#
# Ubuntu 12.10 based web server installation script
# Run this by executing the following from a fresh install of Ubuntu 12.10 server:
#
@simkimsia
simkimsia / testTry.java
Created April 13, 2013 13:19
show Chun that try works
public class testTry {
public static void main(String[] args) {
String test = "test";
try{
test = "now changed";
}catch(Exception e) {
}
@simkimsia
simkimsia / ExceptionDemo19.java
Last active December 16, 2015 04:39
exercise 24
public class ExceptionDemo19 {
public void doC() throws Exception {
throw new Exception("test");
}
public void doB() throws Exception {
doC();
}
public void doA() throws Exception {
doB();
}
import java.util.*;
import java.io.*;
public class TestTry{
public static void main(String []args){
int a = 5;
int b = receiveNumberFromUser();
}
public class ExceptionDemo20 {
public static void main (String[] args) throws Exception{
a();
}
public static void a() throws Exception{
try {
c();
} catch (Exception e) {
b();
}