Skip to content

Instantly share code, notes, and snippets.

View skyjia's full-sized avatar
🎯
Focusing

Sky JIA skyjia

🎯
Focusing
View GitHub Profile
@skyjia
skyjia / git-overwrite-branch.sh
Created July 21, 2021 08:10 — forked from ummahusla/git-overwrite-branch.sh
Git overwrite branch with another branch
# overwrite master with contents of feature branch (feature > master)
git checkout feature # source name
git merge -s ours master # target name
git checkout master # target name
git merge feature # source name
@skyjia
skyjia / update-version.sh
Created August 31, 2017 03:51 — forked from jellybeansoup/update-version.sh
Script for Incrementing Version Numbers
#!/bin/bash
# Link: <https://gist.github.com/jellybeansoup/db7b24fb4c7ed44030f4>
#
# A command-line script for incrementing build numbers for all known targets in an Xcode project.
#
# This script has two main goals: firstly, to ensure that all the targets in a project have the
# same CFBundleVersion and CFBundleShortVersionString values. This is because mismatched values
# can cause a warning when submitting to the App Store. Secondly, to ensure that the build number
# is incremented appropriately when git has changes.
#
@skyjia
skyjia / boot.js
Last active August 29, 2015 14:06 — forked from jdx/boot.js
// This script will boot app.js with the number of workers
// specified in WORKER_COUNT.
//
// The master will respond to SIGHUP, which will trigger
// restarting all the workers and reloading the app.
var cluster = require('cluster');
var workerCount = process.env.WORKER_COUNT || 2;
// Defines what each worker needs to run

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@skyjia
skyjia / nginx.sh
Created March 30, 2013 13:50 — forked from squarism/nginx.sh
#!/bin/bash
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the nginx web server
# Description: starts nginx using start-stop-daemon
sudo su -
# stuff we need to build from source
apt-get install libpcre3-dev build-essential libssl-dev
# get the nginx source
cd /opt/
wget http://nginx.org/download/nginx-0.8.54.tar.gz
tar -zxvf nginx*
# we'll put the source for nginx modules in here
@skyjia
skyjia / server.go
Created September 23, 2012 12:32 — forked from wanghailei/server.go
A simple server in Go
package main
import "net/http"
func main() {
panic(http.ListenAndServe(":8080", http.FileServer(http.Dir("/File/Folder/Path"))))
}