Skip to content

Instantly share code, notes, and snippets.

View chrislovecnm's full-sized avatar
😃
Living LIFE!!

Chris Love chrislovecnm

😃
Living LIFE!!
View GitHub Profile
@chrislovecnm
chrislovecnm / gist:1525241
Created December 27, 2011 21:37
Git Cheat Sheet

Git overview / cheat sheet

Some common commands that are used with git

  • init
  • log
  • rebase - like a merge (change the order of commits)
  • merge
  • commit
@chrislovecnm
chrislovecnm / gist:2322545
Created April 6, 2012 19:58
Backups Redis and Cassandra
- redis-cli BGSAVE
- on each cassandra node nodetool -h localhost -p 7199 snapshot snapshot-name
// taken from http://snes9x-rr.googlecode.com/svn/trunk/snes9x-151/lua-engine.cpp
// http://snes9x-rr.googlecode.com/svn/trunk/snes9x-151/SFMT/SFMT.c
// same as math.random, but uses SFMT instead of C rand()
// FIXME: this function doesn't care multi-instance,
// original math.random either though (Lua 5.1)
static int sfmt_random (lua_State *L) {
lua_Number r = (lua_Number) genrand_real2();
switch (lua_gettop(L)) { // check number of arguments
case 0: { // no arguments
@chrislovecnm
chrislovecnm / jmxtrans
Last active November 6, 2015 21:42
jmxtrans debian init script
#!/bin/sh
### BEGIN INIT INFO
# Provides: jmxtrans
# Required-Start: $local_fs $network $named $time $syslog
# Required-Stop: $local_fs $network $named $time $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Description: JMX Proxy
### END INIT INFO
@chrislovecnm
chrislovecnm / install-stack-cass.sh
Last active November 6, 2015 21:46
Install Stackdriver and JMX Trans for Cassandra
#!/bin/bash
STACKDRIVER_API_KEY=$1
JMX_HOST="localhost"
JMX_PORT="7199"
CASSANDRA_HOST="localhost"
CASSANDRA_PORT="7199"
curl -O https://repo.stackdriver.com/stack-install.sh
sudo bash stack-install.sh --api-key=$STACKDRIVER_API_KEY
@chrislovecnm
chrislovecnm / elasticsearch.conf
Created November 6, 2015 22:04
elasticsearch.conf for Stackdriver
LoadPlugin match_regex
LoadPlugin target_set
PreCacheChain "RenameES"
<Chain "RenameES">
<Rule "rename_es">
<Match regex>
Plugin "^curl_json$"
PluginInstance "elasticsearch"
</Match>
<Target "set">
@chrislovecnm
chrislovecnm / gist:4464615
Created January 6, 2013 01:06
Image scaling
http://www.thebuzzmedia.com/software/imgscalr-java-image-scaling-library/#solve
https://github.com/thebuzzmedia/imgscalr
http://stackoverflow.com/questions/10245220/java-image-resize-maintain-aspect-ratio
@chrislovecnm
chrislovecnm / iGivefirst API Draft
Created March 13, 2013 15:38
iGivefirst API Draft
#iGivefirst API
This api allows iGivefirst partners to show nonprofit advertisements on their websites and collect donations on behalf of iGivefirst, and nonprofits.
## General Concepts
### Guids
Our API utizes business keys in the form of standard 36 character guids. These guids are created with-in our system and are unique. The main guids that are utilized:
@chrislovecnm
chrislovecnm / find-out-what-is-using-your-swap.sh
Last active December 23, 2015 14:59
what is using your swap find-out-what-is-using-your-swap.sh
#!/bin/bash
# find-out-what-is-using-your-swap.sh
# -- Get current swap usage for all running processes
# --
# -- rev.0.3, 2012-09-03, Jan Smid - alignment and intendation, sorting
# -- rev.0.2, 2012-08-09, Mikko Rantalainen - pipe the output to "sort -nk3" to get sorted output
# -- rev.0.1, 2011-05-27, Erik Ljungstrom - initial version