Skip to content

Instantly share code, notes, and snippets.

View sydcanem's full-sized avatar
🏠
Working from home

James Santos sydcanem

🏠
Working from home
View GitHub Profile
@sydcanem
sydcanem / repair.sh
Last active December 20, 2015 20:59
Mongo db repair
#!/bin/bash
LOCK_FILE=/var/lib/mongodb/mongo.lock
PID_FILE=/var/run/mongo.pid
DAEMON=/usr/local/bin/mongod
DBPATH=/var/lib/mongodb
mongo_running=0
if [ -f $PID_FILE ]; then
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
#!/bin/sh
#
# Use ipfw to throttle bandwidth.
# usage:
# ./throttle.sh # Throttle at default (60KB/s)
# ./throttle.sh 5 # Throttle at custom speed (5KB/s)
# ./throttle.sh off # Turn throttling off
# flush rules
ipfw del pipe 1
;;; js-beautify.el -- beautify some js code
(defgroup js-beautify nil
"Use jsbeautify to beautify some js"
:group 'editing)
(defcustom js-beautify-args "--jslint-happy --brace-style=end-expand --keep-array-indentation"
"Arguments to pass to jsbeautify script"
:type '(string)
:group 'js-beautify)
#EXTM3U
#EXT-X-TARGETDURATION:10
#EXT-X-ALLOW-CACHE:YES
#EXT-X-PLAYLIST-TYPE:VOD
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:1
#EXTINF:10.000,
http://schoolimp-vh.akamaihd.net/i/PD360/media/video/PD360/1502S/1502S_7/1502S_7_,304,552,800,1152,1552,1952,2448,.mp4.csmil/segment1_0_av.ts
#EXTINF:10.000,
http://schoolimp-vh.akamaihd.net/i/PD360/media/video/PD360/1502S/1502S_7/1502S_7_,304,552,800,1152,1552,1952,2448,.mp4.csmil/segment2_0_av.ts
@sydcanem
sydcanem / Dialog.js
Last active August 29, 2015 14:06 — forked from ryanflorence/Dialog.js
var Dialog = React.createClass({
render: function() {
// 1) render nothing, this way the DOM diff will never try to do
// anything to it again, and we get a node to mess with
return React.DOM.div();
},
componentDidMount: function() {
// 2) do DOM lib stuff
this.node = this.getDOMNode();
@sydcanem
sydcanem / resolving_conflicts_in_merge.md
Last active August 29, 2015 14:06
Git: Resolving merge conflicts properly with git blame.

Resolving merge conflicts properly with git blame

Continuing with [github's guide to resolving merge conflicts.][1]

This guide will go through resolving merge conflicts that spans to multiple files and more than one people has made a change on the conflicted files. Usually this conflicts occurs when a feature/release branch has made changes to common files or modules that was also been changed on the dev branch.

Mac Homebrew (RVM/MySQL/Redis) setup

Follow the steps below to setup a local development environment:

XQuartz

Recommended to download latest XQuartz

iTerm2

Get Git log in JSON format

git log --pretty=format:'{%n  "commit": "%H",%n  "abbreviated_commit": "%h",%n  "tree": "%T",%n  "abbreviated_tree": "%t",%n  "parent": "%P",%n  "abbreviated_parent": "%p",%n  "refs": "%D",%n  "encoding": "%e",%n  "subject": "%s",%n  "sanitized_subject_line": "%f",%n  "body": "%b",%n  "commit_notes": "%N",%n  "verification_flag": "%G?",%n  "signer": "%GS",%n  "signer_key": "%GK",%n  "author": {%n    "name": "%aN",%n    "email": "%aE",%n    "date": "%aD"%n  },%n  "commiter": {%n    "name": "%cN",%n    "email": "%cE",%n    "date": "%cD"%n  }%n},'

The only information that aren't fetched are:

  • %B: raw body (unwrapped subject and body)
  • %GG: raw verification message from GPG for a signed commit
@sydcanem
sydcanem / Nginx gzip.conf
Last active March 3, 2024 18:27
Gzip configuration for Nginx
#Enable Gzip compressed.
gzip on;
# Enable compression both for HTTP/1.0 and HTTP/1.1.
gzip_http_version 1.1;
# Compression level (1-9).
# 5 is a perfect compromise between size and cpu usage, offering about
# 75% reduction for most ascii files (almost identical to level 9).
gzip_comp_level 5;