Skip to content

Instantly share code, notes, and snippets.

View benmezger's full-sized avatar
:octocat:
hacking

Ben Mezger benmezger

:octocat:
hacking
View GitHub Profile
@benmezger
benmezger / fat16.c
Created July 11, 2017 20:14
move filename to a fat16 image
int write_dir(FILE *fp, char *fname, struct fat_dir *dir){
strncpy((char *) dir->name, (char *) fname, sizeof(fname));
if (fwrite(dir, 1, sizeof(struct fat_dir), fp) <= 0)
return -1;
return 0;
}
int write_data(FILE *fp, char *fname, struct fat_dir *dir, struct fat_bpb *bpb){

Keybase proof

I hereby claim:

  • I am benmezger on github.
  • I am seds (https://keybase.io/seds) on keybase.
  • I have a public key ASCpPd8-czLpjJ4grfQaxbehHKyPMYVIw0FT2qsCuC2wWQo

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am benmezger on github.
  • I am benmezger (https://keybase.io/benmezger) on keybase.
  • I have a public key whose fingerprint is C473 DDC9 D1B1 40AF 2051 1CF6 18C4 6052 1688 92F7

To claim this, I am signing this object:

@benmezger
benmezger / gist:222359c5f3d5b061a579554cf44a4bf3
Created May 11, 2017 19:21
If a root user is executing `rm`, make sure it does it safe.
[ $UID = 0 ] && \
alias rm='rm -i' && \
alias mv='mv -i' && \
alias cp='cp -i'
@benmezger
benmezger / dircolors
Created November 16, 2016 22:01
dircolors-monokai
# Monokai color theme for the color GNU ls utility.
# Designed for dircolors (GNU coreutils) 5.97
#
# This file was largely inspired by seebi/dircolors-solarized on github.
#
# How the colors were selected:
# - Terminal emulators often have an option typically enabled by default that makes
# bold a different color. It is important to leave this option enabled so that
# you can access the entire 16-color palette, and not just 8 colors.
# - We favor universality over a greater number of colors. So we limit the number
#
# dotzsh : https://github.com/dotphiles/dotzsh
#
# Defines environment variables.
#
# Authors:
# Ben O'Hara <bohara@gmail.com>
#
# Paths
#
# Provides for an easier use of GPG by setting up gpg-agent.
#
# Authors:
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
# Return if requirements are not found.
if (( ! $+commands[gpg-agent] )); then
return 1

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

#!/usr/bin/env python
fg = '\033[38;5;'
bg = '\033[48;5;'
for i in range( 0, 256):
n = str(i)
fgstr = fg + n + 'm' + n
bgstr = bg + n + 'm' 'XXXXX'
print fgstr, bgstr, '\033[0m'
@benmezger
benmezger / prompt_unix_setup
Created September 4, 2016 19:26
My Custom zprezto prompt theme
############ BEGIN SORIN #############
# https://github.com/sorin-ionescu/prezto/blob/master/modules/prompt/functions/prompt_sorin_setup
function prompt_unix_pwd {
local pwd="${PWD/#$HOME/~}"
if [[ "$pwd" == (#m)[/~] ]]; then
_prompt_unix_pwd="$MATCH"
unset MATCH
else