Skip to content

Instantly share code, notes, and snippets.

View qguv's full-sized avatar
vibing

Quint Guvernator qguv

vibing
View GitHub Profile
@qguv
qguv / timer.sh
Last active September 25, 2015 01:18
simple timer using zenity
#! /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 October 2, 2011 07:37
This is a simple program to calculate the last intelligible 70% of any string of text, also known as Wadsworth's Constant
#! /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 April 5, 2021 04:50 — forked from nicolashery/solarized-dark.css
Solarized theme for Jekyll, updated to reflect toned-down line numbers
/* 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 February 26, 2014 15:06
Simple examples of reduce, map, filter, lambda, and unpacking in Python 2
#!/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 June 5, 2014 21:15
an introduction beyond the basic commit workflow

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 March 4, 2024 17:14
Automatic WPA Supplicant Configuration for GNU/Linux

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
@qguv
qguv / gist:ffaa67fca814cf0f49ec
Last active August 29, 2015 14:03
Roll your own vim
# 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 September 2, 2014 14:27
kill a process running on port 8000 (or any other port)
sudo kill `sudo lsof -t -i:8000`
@qguv
qguv / iterm2-no-dock.sh
Last active August 29, 2015 14:08
Remove iTerm2 from Dock & Cmd+Tab
defaults write /Applications/iTerm.app/Contents/Info LSUIElement true
@qguv
qguv / quota.sh
Created December 7, 2014 06:39
get number of files in subdirectories of this one
find . -maxdepth 1 -mindepth 1 -type d | while read dir; do
printf "%-25.25s : " "$dir"
find "$dir" -type f | wc -l
done