Skip to content

Instantly share code, notes, and snippets.

@qguv
qguv / timer.sh
Last active Sep 25, 2015
simple timer using zenity
View timer.sh
#! /bin/bash
# Timed unlock script. Must be run as root.
input=$(zenity --entry --text="Enter directory to be unlocked.")
name="$input"
thetime="5"
unit="m"
(
counter=0
@qguv
qguv / wadsworth_constant.py
Created Oct 2, 2011
This is a simple program to calculate the last intelligible 70% of any string of text, also known as Wadsworth's Constant
View wadsworth_constant.py
#! /bin/python
print "Wadsworth's Constant"
theString = raw_input('] ')
theStringLength = len(theString)
WadsworthsAmount = int(round((0.3) * theStringLength))
firstSpace = theString.find(' ', WadsworthsAmount)
if firstSpace == -1:
FinalString = theString[WadsworthsAmount:]
else:
FinalString = theString[firstSpace+1:]
@qguv
qguv / solarized-dark.css
Last active Apr 5, 2021 — forked from nicolashery/solarized-dark.css
Solarized theme for Jekyll, updated to reflect toned-down line numbers
View solarized-dark.css
/* Solarized Dark
For use with Jekyll and Pygments
http://ethanschoonover.com/solarized
SOLARIZED HEX ROLE
--------- -------- ------------------------------------------
base03 #002b36 background
base01 #586e75 comments / secondary content
@qguv
qguv / functional_python.py
Created Feb 26, 2014
Simple examples of reduce, map, filter, lambda, and unpacking in Python 2
View functional_python.py
#!/usr/bin/env python2
# Functional Python: reduce, map, filter, lambda, *unpacking
# REDUCE EXAMPLE
add = lambda *nums: reduce(lambda x, y: x + y, nums)
def also_add(*nums):
'''Does the same thing as the lambda expression above.'''
def add_two_numbers(x, y):
@qguv
qguv / intermediate git.md
Created Jun 5, 2014
an introduction beyond the basic commit workflow
View intermediate git.md

INTERMEDIATE GIT

git v2.0.0

documentation

$ cd ~/Desktop

  • git help branch
  • man git
  • not man git branch
@qguv
qguv / internet_uccs.md
Last active Aug 29, 2015
Automatic WPA Supplicant Configuration for GNU/Linux
View internet_uccs.md

Get a hard-wired ethernet connection

Disable all other network daemons

This is just an example; disable and stop all active daemons.

sudo systemctl stop dhcpcd
sudo systemctl disable dhcpcd
View gist:ffaa67fca814cf0f49ec
# replace --with-python-config-dir and --with-lua-prefix with a system-specific directory
mkdir -p ~/build
cd ~/build
hg clone https://vim.googlecode.com/hg/ vim
cd vim
hg pull
hg update
# might also need --with-python-config-dir=/usr/lib64/python2.6/config
@qguv
qguv / gist:9b9c0fb45d5124dd641a
Created Sep 2, 2014
kill a process running on port 8000 (or any other port)
View gist:9b9c0fb45d5124dd641a
sudo kill `sudo lsof -t -i:8000`
@qguv
qguv / iterm2-no-dock.sh
Last active Aug 29, 2015
Remove iTerm2 from Dock & Cmd+Tab
View iterm2-no-dock.sh
defaults write /Applications/iTerm.app/Contents/Info LSUIElement true
@qguv
qguv / quota.sh
Created Dec 7, 2014
get number of files in subdirectories of this one
View quota.sh
find . -maxdepth 1 -mindepth 1 -type d | while read dir; do
printf "%-25.25s : " "$dir"
find "$dir" -type f | wc -l
done