Skip to content

Instantly share code, notes, and snippets.

View ikennaokpala's full-sized avatar
🎯
Focusing

Ikenna N. Okpala ikennaokpala

🎯
Focusing
View GitHub Profile
@ikennaokpala
ikennaokpala / full_proxy_setup.sh
Last active November 1, 2018 18:03
Behind enemy lines (full proxy setup)
Export your shell environment for http proxy use
export http_proxy="http://hostname:port" or save it to your shell profile. (i.e. ~/.bash_rc)
export http_proxy='http://example.proxy_name.com:80'
For multi-user installs, use sudo -E to preserve the proxy settings in your environment:
Setting git to use a proxy
git config --global url.https://github.com/.insteadOf git://github.com/
git config --global http.proxy %http_proxy%
@subelsky
subelsky / dependency_injection_container.rb
Created September 10, 2012 14:28
Code examples for Ruby Dependencies, Notifications, and Adjustments (Ruby DNA)
require "dim"
AppContainer = Dim::Container.new
AppContainer.register(:env) { ENV['ADWORK_ENV'] || "development" }
AppContainer.register(:production?) { |c| c.env == 'production' }
AppContainer.register(:development?) { |c| c.env == 'development' }
AppContainer.register(:test?) { |c| c.env == 'test' }
AppContainer.register(:root) { File.expand_path(File.dirname(__FILE__)+"/../..") }
AppContainer.register(:logger) do |c|
@ikennaokpala
ikennaokpala / bootstrap_janus_vim.sh
Created July 5, 2012 12:24
bootstrap_janus_vim
function die()
{
echo "${@}"
exit 1
}
# Add <strong>.old</strong> to any existing Vim file in the home directory
for i in $HOME/.vim $HOME/.vimrc $HOME/.gvimrc; do
if [[ ( -e $i ) || ( -h $i ) ]]; then
echo "${i} has been renamed to ${i}.old"
@CodySwannGT
CodySwannGT / cloudflare.conf
Created April 26, 2012 01:22
WordPress/Nginx/PHP/Varnish Configuration
# /etc/nginx/cloudflare.conf
# If using Cloudflare, uncomment the following to get proper originating IPs
#set_real_ip_from 204.93.240.0/24;
#set_real_ip_from 204.93.177.0/24;
#set_real_ip_from 199.27.128.0/21;
#set_real_ip_from 173.245.48.0/20;
#set_real_ip_from 103.22.200.0/22;
#set_real_ip_from 141.101.64.0/18;
#real_ip_header CF-Connecting-IP;
@casualjim
casualjim / CORSSupport.scala
Created October 22, 2011 21:20
CORS Support for scalatra
package backchat
package web
import javax.servlet.http.{ HttpServletResponse, HttpServletRequest }
import org.scalatra._
import collection.JavaConversions._
object CORSSupport {
val ORIGIN_HEADER: String = "Origin"
val ACCESS_CONTROL_REQUEST_METHOD_HEADER: String = "Access-Control-Request-Method"
@ryanb
ryanb / spec_helper.rb
Created September 12, 2011 21:37
Use RSpec tags to add behavior around specs.
# Add this to your spec_helper.rb
RSpec.configure do |config|
config.treat_symbols_as_metadata_keys_with_true_values = true
config.around(:each, :vcr) do |example|
name = example.metadata[:full_description].downcase.gsub(/\W+/, "_").split("_", 2).join("/")
VCR.use_cassette(name, :record => :new_episodes) do
example.call
end
end
end
import sbt._
import Keys._
import org.sbtidea._
import SbtIdeaPlugin._
import Scope.{GlobalScope, ThisScope}
object BuildSettings {
val buildOrganization = "com.mojolly.backchat"
val buildScalaVersion = "2.9.0-1"
val buildVersion = "0.8.1-SNAPSHOT"
@casualjim
casualjim / rvmrc.sh
Created June 2, 2011 14:02
baseline rvmrc file
export RUBYOPT="rubygems"
rvm_install_on_use_flag=1
if [ -z $(rvm gemset list | grep virtmachines) 2> /dev/null ]; then
rvm ruby-1.8.7
rvm gemset create virtmachines
fi
rvm ruby-1.8.7@virtmachines
package com.mojolly.backchat
package web
import org.scalatra.ScalatraServlet
import akka.actor.{Scheduler, Actor}
import javax.servlet.http.{HttpServletResponse, HttpServletRequest}
import org.atmosphere.cpr.BroadcastFilter.BroadcastAction
import org.atmosphere.cpr._
import org.atmosphere.util.XSSHtmlFilter
import collection.JavaConversions._