Skip to content

Instantly share code, notes, and snippets.

View qguv's full-sized avatar
vibing

Quint Guvernator qguv

vibing
View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@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 / vbox_efi_persist.md
Last active November 25, 2015 15:21
Virtual Box EFI persistance workaround

Is Virtual Box's EFI firmware failing to keep data between VM restarts? Have you tried both manual configuration and efibootmgr to no avail?

Make a file called startup.nsh containing your kernel boot line, e.g.

vmlinuz-linux root=/dev/sdXY initrd=/initramfs-linux.img

This will use EFISTUB to boot the kernel directly, see https://wiki.archlinux.org/index.php/EFISTUB#Using_UEFI_Shell. This still isn't really causing persisting changes (e.g. config changes via the NVRAM still don't persist) but at least this lets you boot EFI without fiddling with settings all the time.

Keybase proof

I hereby claim:

  • I am qguv on github.
  • I am qguv (https://keybase.io/qguv) on keybase.
  • I have a public key whose fingerprint is 65A6 6455 A2A5 CAC8 13E4 93FB FC13 890A 40FE EF7B

To claim this, I am signing this object:

#!/usr/bin/env python3
'''Created to answer the question: How does bitcoin mining work? Key
differences between this method and bitcoin's:
- This method doesn't actually store transactions. :-)
- This primes the hash function with the previous nonce solution, so solving
for the nth iteration necessarily requires a solution for the (n-1)
iteration and all iterations before it. Bitcoin primes the hash function
with the entire previous block, (which includes its nonce). This method is
@qguv
qguv / colemak.svg
Created August 22, 2016 22:53
Vi(m) graphical cheat sheet, colemak style
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@qguv
qguv / gist:b57be7657a6e0fc99c7e9865471f052a
Last active October 20, 2016 06:12
Faster Computers (using only the ten hundred most used words)
Computers are great because they do exactly what they're told, very fast. But
sometimes, we need things done faster than a computer can do them. What can we
build that's faster than a computer?
If you want to work on something, it will be faster if your friend does one
part while you do another. Two people working on different things at the same
time are faster than one person doing everything alone.
Computers work the same way: If you can break up what you want the computer to
do into smaller things, and then get different computers to work on those
@qguv
qguv / ls.c
Last active February 7, 2017 09:30 — forked from syntactician/ls.c
#include <stdio.h> /* printf, puts, putchar */
#include <unistd.h> /* fork, execv */
#include <sys/ioctl.h> /* get username */
#include <sys/wait.h> /* join processes */
#include <sys/types.h> /* pid_t */
#include <string.h> /* strcpy, strncpy, memcpy */
#define MAX_WIDTH 80
#define MAX_CMD 64
@qguv
qguv / userland_talk.md
Last active March 2, 2017 22:28
Userland talk for W&M ACM

UNIX: userland and the shell

  • GUI file managers are built on top of coreutils (GNU/BSD)
  • you can just run the coreutils directly in a shell
    • reads command and spits out the result
    • matrix of monospaced text
  • syntax: binary space arg1 space arg2 space ...

exercises