Skip to content

Instantly share code, notes, and snippets.

View nopolabs's full-sized avatar

Dan Revel nopolabs

View GitHub Profile
@nopolabs
nopolabs / silex
Last active December 15, 2015 22:09
composer.json
---
{
"require": {
"silex/silex": "1.0.*@dev"
},
"autoload": { "psr-0": { "App": "./app" } }
}
#/bin/bash
DEV_DIR=riak-1.2.1/dev
for i in 1 2 3 4
do
PORT_PREFIX=99${i}
APP_CONFIG=${DEV_DIR}/dev${i}/etc/app.config
cp $APP_CONFIG $APP_CONFIG.bak
perl -pi -e "s/(pb_port,)\s*\d+/\1 ${PORT_PREFIX}1/" $APP_CONFIG
perl -pi -e "s/(http,.*127.0.0.1.*,)\s*\d+/\1 ${PORT_PREFIX}2/" $APP_CONFIG
@nopolabs
nopolabs / coin_core.clj
Created January 15, 2013 05:47
greedy change
(ns coin.core)
(def no-change {1 0 5 0 10 0 25 0})
(def coins [25 10 5 1])
(defn count-change
[change]
(reduce
(fn [value coin]
@nopolabs
nopolabs / remove_trailing_whitespace_from_java
Created May 12, 2012 22:16
Removing trailing whitespace in java files.
find . -name \*.java -exec sed -i 's/[ \t]*$//' '{}' ';'
@nopolabs
nopolabs / nmvn
Created May 12, 2012 22:19
Create a new project using maven's quickstart archetype
#!/bin/bash
PKG=${1:?Usage: nmvn pkg}
PACKAGE=com.nopolabs.$PKG
mvn archetype:generate -DgroupId=$PACKAGE -DartifactId=$PACKAGE -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
@nopolabs
nopolabs / login.rb
Created December 11, 2011 03:21 — forked from amscotti/login.rb
Sample of Sinatra authentication
require 'rubygems'
require 'bcrypt'
require 'haml'
require 'sinatra'
enable :sessions
userTable = {}
helpers do
@nopolabs
nopolabs / gist:1354281
Created November 10, 2011 06:41 — forked from hay/gist:1351230
Enterprisify your Java Class Names!
<!doctype html>
<html>
<head>
<title></title>
<style>
body {
background: white;
text-align: center;
padding: 20px;
font-family: Georgia, serif;
@nopolabs
nopolabs / list-yum.sh
Created April 27, 2015 20:09
list packages in a given yum repo
sudo yum --disablerepo="*" --enablerepo="osis" --showduplicates list available