Skip to content

Instantly share code, notes, and snippets.

View sourcec0de's full-sized avatar
:octocat:
Focusing

James R Qualls sourcec0de

:octocat:
Focusing
View GitHub Profile
@sourcec0de
sourcec0de / HowTo.md
Last active December 11, 2015 00:19
Solve Rails / Rack SSL Issues

###How to fix

  • Step 1 - Download "cacert.pem" attached to this gist
  • Step 2 - Copy the files system path (i.e wherever you saved it) "c:/certs/cacert.pem"
  • Step 3 - Create an Evironmental variable and set it to your certs path
SSL_CERT_FILE = c:/certs/cacert.pem
  • Step 5 - Restart Rails Server
@sourcec0de
sourcec0de / loadTest.js
Created February 7, 2013 00:53
Real World Load Testing -> How the pros do it
// Load testing:
// Stress your hardware as hard as you can
// Attempting to create as close to a real
// environment as possible
// Apache Bench: -> Its okay
// 1 resource at a time
// no real browser testing
// Seage:
@sourcec0de
sourcec0de / install_nodejsV0.10.9.sh
Last active November 15, 2018 08:44
A Rock solid nodejs platform install script. Latest Redis, MongoDB, and NodeJS V10.9.0 tested Ubuntu 13.04 X64
#!/bin/sh
# Add MongoDB Package
echo "Add MongoDB Package"
echo "deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen" >> /etc/apt/sources.list
apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10
echo "MongoDB Package completed"
# Update System
echo "System Update"

Install Redis 2.6 as a Service on Ubuntu

  1. Install Ubuntu updates, set time zones, followed by GCC and Make
sudo apt-get update
sudo apt-get -y install build-essential
  1. Install tcl8.5 for Redis
#! /bin/sh
### BEGIN INIT INFO
# Provides: redis-server
# Required-Start: $syslog $remote_fs
# Required-Stop: $syslog $remote_fs
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: redis-server - Persistent key-value db
/* sample aggregate command queries */
// make sure we're using the right db; this is the same as "use mydb;" in shell
db = db.getSisterDB("aggdb");
// just passing through fields
var p1 = db.runCommand(
{ aggregate : "article", pipeline : [
{ $project : {
tags : 1,
pageViews : 1
var cluster = require('cluster'),
app = require('./app');
var workers = {},
count = require('os').cpus().length;
function spawn(){
var worker = cluster.fork();
workers[worker.pid] = worker;
return worker;
@sourcec0de
sourcec0de / PrivateTorrent.md
Last active September 1, 2022 09:04
Host a private torrent tracker, and seed a torrent on ubuntu 12.10

Install dep, and start tracker

sudo apt-get install bittornado ctorrent
bttrack --port 6969 --dfile ~/.bttrack/dstate --logfile ~/.bttrack/tracker.log --nat_check 0 --scrape_allowed full

Now, create a torrent file

ctorrent -t -u "YOUR_SERVER_IP:6969/announce" -s new_file_name.torrent file_or_folder_for_torrent
@sourcec0de
sourcec0de / setup.sh
Last active December 16, 2015 02:49
Full Dev Env Install for Ubuntu 13.04. Includes Ruby, NodeJS, MongoDB, Redis
echo "This script requires superuser access to install apt packages."
echo "You will be prompted for your password by sudo."
# clear any previous sudo permission
sudo -k
# run inside sudo
sudo sh <<SCRIPT
# Update ubuntu install basic dep
@sourcec0de
sourcec0de / es.sh
Last active December 16, 2015 03:09
Download and install elasticSearch 0.90.0 as a service.
echo "This script requires superuser access to install apt packages."
echo "You will be prompted for your password by sudo."
# clear any previous sudo permission
sudo -k
cd ~
sudo sh <<SCRIPT
apt-get update
apt-get install openjdk-7-jre-headless -y