Skip to content

Instantly share code, notes, and snippets.

View rothwerx's full-sized avatar

Jeremiah Roth rothwerx

View GitHub Profile
@rothwerx
rothwerx / gist:5595947
Created May 16, 2013 23:31
Bash: Keep or Delete?
#keep or delete?
function kod()
{
ls -l $@
echo "Keep (k) or Delete (d)?"
read answer
if [ $answer == "k" ]; then
echo "Keeping. As you wish."
elif [ $answer == "d" ]; then
echo "DELETING $@"
@rothwerx
rothwerx / gist:5681392
Created May 30, 2013 21:28
Brocade: Disabling stack to set IP on FLS 648-STK switch
config t
stack disable
ip route 0.0.0.0 0.0.0.0 10.50.42.1
vlan 42
router-interface ve 42
int ve 42
ip address 10.50.42.xxx 255.255.255.0
end
wr mem
@rothwerx
rothwerx / gist:5960677
Last active December 19, 2015 13:18
Python: Use hpilo to query iLO ambient temperature sensor, i.e. use HP sensors for ghetto datacenter temperature monitoring
import hpilo
tempkey = {
2 : 'Temp 1',
3 : 'Temp 1',
4 : '01-Inlet Ambient'
}
def get_ambient_temp(host, username, password, ilo_version):
try:
@rothwerx
rothwerx / gist:6067761
Last active December 20, 2015 03:59
Bash: My typical bashrc configuration for virtualenvwrapper
# ~/.bashrc
export PROJECT_HOME=$HOME/Sandbox/venvs
export WORKON_HOME=$HOME/.venvs
source /usr/local/bin/virtualenvwrapper.sh
@rothwerx
rothwerx / gist:6068063
Created July 24, 2013 04:26
Bash: Color prompt for OS X
# ~/.bash_profile on OS X (though could be .bashrc on other OS's)
export PS1="\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\$ "
export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad
alias ls='ls -GFh'
@rothwerx
rothwerx / gist:6068070
Created July 24, 2013 04:27
Vim: Set syntax highlighting on OS X
# Just basic syntax highlighting for vim
set nocompatible
syntax on
colo peachpuff
@rothwerx
rothwerx / gist:6128390
Created August 1, 2013 04:21
PHP: Custom Drupal (5) module for Bronto email APIv4. Only putting it here because the internet lacks good examples of the Bronto API. Add error handling as needed.
<?php
function bronto_menu($may_cache) {
$items = array();
if ($may_cache) {
$items[] = array(
'path' => 'admin/mymodule/settings/bronto',
'access' => user_access('administer site configuration'),
'title' => t('Bronto settings'),
@rothwerx
rothwerx / gist:6499935
Created September 9, 2013 18:57
Bash: Deal with it
function dealwithit() {
echo "( °_°)"
sleep 1
tput cuu1
tput el
echo "( °_°)‿‑●‑●"
sleep 2
tput cuu1
tput el
echo "(‑●‑●)>"
@rothwerx
rothwerx / gist:6574543
Last active December 23, 2015 03:39
Bash: Animated dance. Useful for your celebrating when your multi-pipe one-liner works on the first try.
function _totheleft() {
echo "(°_°)"
echo "<) )╯"
echo ' / \'
}
function _totheright() {
echo " (°_°)"
echo "\( (>"
echo ' / \'
@rothwerx
rothwerx / gist:7146476
Created October 24, 2013 22:48
Go: Small example of running system commands
package main
import "os/exec"
import "fmt"
import "bytes"
func main() {
cmd := exec.Command("/bin/ls", "-al")
var out bytes.Buffer
cmd.Stdout = &out