Skip to content

Instantly share code, notes, and snippets.

@nbrew
nbrew / cve_appled_in_rpm.sh
Created March 2, 2012 00:34
CVE mentioned in an RPM's change history
# CVE should be in the format of CVE-xxxx-xxxx
function verify_cve_applied() {
package=$1
cve=$2
rpm -q --changelog ${package} | grep ${cve}
return $?
}
@nbrew
nbrew / rvm_install_rubies.sh
Created March 28, 2012 20:21
RVM, Ruby 1.8.7/1.9.3 on Mac OS X 10.6
#!/bin/bash
# If rvm is already installed:
# rvm implode
# install rvm
bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
# install ruby requirements specific to the rvm env:
rvm pkg install readline && rvm pkg install iconv
@nbrew
nbrew / README.md
Created March 29, 2012 23:41 — forked from cypriss/README.md
Rails 2.3.14 Ruby 1.9.3 - Monkey Patches
@nbrew
nbrew / reorderable_list.js
Created November 29, 2012 20:25
Reorderable List Javascript Library
// Sample Usage:
// var init_sortable_events = function() {
// var rl, category_id;
// jQuery('#list-info ul').each(function(index, element){
// category_id = element.id.split('_')[1];
// rl = new ReorderableList();
// rl.reorder_action_element = '#event_category_events_reorder_action_' + category_id;
// rl.reorder_action_done_element = '#event_category_events_reorder_action_done_' + category_id;
// rl.sortable_list_id = '#' + element.id;
// rl.update_url = '/admin/events/update_positions';
@nbrew
nbrew / bash_login.sh
Last active December 10, 2015 00:58
My .bash_login
export PATH="/usr/local/bin:/usr/local/sbin:$PATH:~/bin:/usr/local/mysql/bin:/usr/local/mongodb/bin:/Users/nathan/workspace/Sandbox/nbrew-git-achievements:/usr/local/android/tools"
export MANPATH="/usr/local/man:$PATH"
#export CPPFLAGS="-I/opt/local/include -I/Users/nathan/local/include"
export LDFLAGS="-L/usr/local/lib"
export LD_LIBRARY_PATH="/lib:/usr/lib:/usr/local/lib:/usr/local/mysql/lib"
export DISPLAY=:0.0
export SVN_EDITOR=/usr/bin/vim
export HISTCONTROL='ignoredupes'
export EDITOR=subl
@nbrew
nbrew / haxe_osx_manual_install.sh
Last active August 29, 2023 12:30
Remove and reinstall haxe and neko.
#!/bin/bash
mkdir -p ~/Downloads/src
cd ~/Downloads/src
function uninstall_haxe() {
sudo rm -rf /usr/bin/haxe /usr/bin/haxelib /usr/lib/haxe
}
function install_haxe() {
@nbrew
nbrew / gist:6393764
Last active December 22, 2015 01:08 — forked from anonymous/gist:4410510
iOS - Fade from the splash screen to your initial view.
// based on and inspired by https://gist.github.com/1026439 and https://gist.github.com/3798781
//
// MIT license. Use however you'd like.
//
// first, define our macro for delaying our transition:
#define PKWaitDelay(dly, block) dispatch_after(dispatch_time(DISPATCH_TIME_NOW,dly*100000),dispatch_get_main_queue(), ^{ block })
// then, inside your AppDelegate.m in didFinishLaunchingWithOptions:
UIImageView *imageView = [[UIImageView alloc] initWithFrame:self.window.frame];
@nbrew
nbrew / vhost_setup.sh
Last active December 22, 2015 20:39
Custom vhosts setup on Mac OS X 10.8. * Stores vhost config files in /etc/apache2/extra/vhosts.d * Creates directories at ~/Sites/{domain} to house files to be served and log files * Appends an entry to your /etc/hosts file (if none exists)
#!/bin/bash
# Custom vhosts setup on Mac OS X 10.8.
#
# * Stores vhost config files in /etc/apache2/extra/vhosts.d
# * Creates directories at ~/Sites/{domain} to house files to be served and log files
# * Appends an entry to your /etc/hosts file (if none exists)
#
# See: https://gist.github.com/nbrew/6527860
#
@nbrew
nbrew / Gemfile
Last active December 27, 2015 17:39 — forked from gorenje/Gemfile
source 'https://rubygems.org'
gem 'sinatra'
gem 'json'
gem 'omniauth'
gem 'omniauth-oauth2'
gem 'omniauth-github'
gem 'omniauth-facebook'
gem 'omniauth-twitter'
# gem 'omniauth-att', :path => File.expand_path("./../../omniauth-att", __FILE__)
@nbrew
nbrew / gist:7713188
Last active December 29, 2015 18:49
SO #20294398
<?php
//error_reporting(0);
include("_models.header.php");
$model= $_GET["modelname"];
$timestamp= date("Y-m-d h:i:s");
mysql_query("UPDATE groupshows SET showended='".$timestamp."' WHERE model='".$model."' AND showended='0'");
mysql_query("UPDATE groupshows SET ended='1', started='0' WHERE model='".$model."' AND customer='0'");
//udregn show cost
$result=mysql_query("SELECT * FROM groupshows where model ='".$model."' AND customer='0'");