Skip to content

Instantly share code, notes, and snippets.

@JamesTheBard
JamesTheBard / gist:5527817
Created May 6, 2013 20:15
Quick output for the "free" command.
jweatherly@rog ~ % last -h
last: invalid option -- 'h'
Usage: last [-num | -n num] [-f file] [-t YYYYMMDDHHMMSS] [-R] [-adioxFw] [username..] [tty..]
1 jweatherly@rog ~ % last -R -F reboot :(
wtmp begins Sun May 5 13:27:59 2013
jweatherly@rog ~ %
@JamesTheBard
JamesTheBard / gist:5659942
Last active December 17, 2015 19:19
The first issue that I see...
' This is what you have Arlen...
do while MoreSold = "yes"
' Notice that you have 'FoodType'
FoodType = Inputbox("What type of food sold? (hamburger, hotdog, corndog, or nacho)")
NumSold = Inputbox("How many were sold?")
' ...and you have 'foodtype' here...
Select Case foodtype
Case "hamburger"
NumSold = NumHamburgers
@JamesTheBard
JamesTheBard / bindings
Last active December 18, 2015 02:28
Quick keybinds for increasing/decreasing volume using i3.
# Brightness bindings
bindsym XF86MonBrightnessUp exec "xbacklight -inc 10"
bindsym XF86MonBrightnessDown exec "xbacklight -dec 10"
# Audio bindings
bindsym XF86AudioPlay exec "mpc toggle"
bindsym XF86AudioStop exec "mpc stop"
bindsym XF86AudioNext exec "mpc next"
bindsym XF86AudioPrev exec "mpc prev"
@JamesTheBard
JamesTheBard / get_song_mpd
Last active December 18, 2015 03:38
Perl script to grab mpd status and information.
#!/usr/bin/env perl
use Switch;
# Grab the first line from 'mpc' and throw it into
@song = split("\n", `mpc 2>&1`);
switch ($song[0]) {
case /Connection refused/ { print "MPD not running\n" }
case /^volume/ { print "Music playback stopped\n"}
@JamesTheBard
JamesTheBard / i3lock_pixelate
Created June 8, 2013 00:04
The cool pixelated i3lock script provided by Steffan Honig.
#!/bin/bash
#
# This is an easier-to-tweak version of Steffen Honig's i3lock
# script. If it doesn't work, it's his fault ;)
#
TEMP_FILE=/tmp/lock.png
TEMP_FILE_POST=/tmp/lock.modified.png
BAR_BG_COLOR="orange"
BAR_FONT_COLOR="white"
BAR_FONT="Source-Code-Pro-Black"
@JamesTheBard
JamesTheBard / clipcp
Last active December 18, 2015 05:39
Clipboard copy script for files.
#!/bin/bash
# Display some help text
usage() {
echo "clipcp - Copy the contents of a text file to the clipboard";
echo "Usage: clipcp FILE";
}
# 'Cat' the file and pipe it into the xsel program which throws whatever
# it gets onto the clipboard.
@JamesTheBard
JamesTheBard / eventcmd
Created June 10, 2013 06:21
mcabber notification script
#!/bin/sh
echo "$1 $2 $3 $4" >> ~/test.mcabber.log
EVENT_TYPE=$1
EVENT_SUBTYPE=$2
JID=$3
FILE=$4
TITLE="Google Hangouts"
SOUND_FILE="$HOME/.mcabber/sounds/alert_47.wav"
ICON="$HOME/.mcabber/images/chat.png"
TIMEOUT=10000
@JamesTheBard
JamesTheBard / download_tags.py
Created July 18, 2013 12:53
A quick update...
from django import template
from cms_downloads.models import FileRevisions
import os
register = template.Library()
def get_latest_download_by_name(file_name):
download_query = FileRevisions.objects.filter(name__name__startswith=filename).order_by('-version')[0]
if download_query.count == 0: download_query = None
return {'cms_download': download_query}
#!/bin/bash
# Variable assignment for legibility. The file content should be
# in the form of:
# username, password
filename=$1
# If the file exists, loop through it and start making accounts
# else just quit and display the help.
if [ -e $filename ]
@JamesTheBard
JamesTheBard / .vimrc
Created December 5, 2014 05:54 — forked from anonymous/.vimrc
set modeline
set ts=4
set sts=4
set et
set sw=4
set ruler
set number
set nofoldenable
set scrolloff=10