Skip to content

Instantly share code, notes, and snippets.

@bgotink
bgotink / mount_tmpfs.sh
Created August 6, 2012 19:16 — forked from koshigoe/mount-ram.sh
Like tmpfs in Mac OS X. This code is public domain.
#!/bin/sh
# This program has two feature.
#
# 1. Create a disk image on RAM.
# 2. Mount that disk image.
#
# Usage:
# $0 <dir> <size>
#
@bgotink
bgotink / brew.log
Created August 16, 2012 21:37
"brew install --HEAD e2fsprogs" log
bram:~/Downloads/backup$ brew install --HEAD e2fsprogs
==> Cloning https://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git
Cloning into '/Library/Caches/Homebrew/e2fsprogs--git'...
remote: Counting objects: 33824, done.
remote: Compressing objects: 100% (7500/7500), done.
remote: Total 33824 (delta 27272), reused 32257 (delta 26058)
Receiving objects: 100% (33824/33824), 16.32 MiB | 139 KiB/s, done.
Resolving deltas: 100% (27272/27272), done.
==> Downloading patches
######################################################################## 100.0%
@bgotink
bgotink / collatz.c
Created September 7, 2012 02:02
Collatz conjecture program in C, depends on libgmp
#include <stdio.h>
#include <string.h>
#include <gmp.h>
/*
* Dependency: libgmp
* Compile using:
* gcc -o collatz -l gmp collatz.c
*/
@bgotink
bgotink / ._what.md
Last active December 25, 2015 06:29 — forked from barijaona/._what.md

Badass git pull alternative

Add this in your path as git-up and git-reup (symbolic link) and it amps up your git pull by means of git up

  1. Adds in a list of the commits you're pulling down
  2. Auto-prunes remote branches
  3. Defaults to pull --rebase - gets rid of unnecessary merge commits. If you don't know what rebase does, this is probably safe for you. If you know what rebase does, you should know where this will not be safe for you.

Kyle Neath, Ryan Tomayko and then Zach Holman basically figured out how to do this. TheSpyder found a small error on case sensitive file systems.

@bgotink
bgotink / angstrom.md
Last active August 29, 2015 13:56
Angstrom compilation for beaglebone

Install dependencies

sudo <aptitute|apt-get> install git-core texinfo chrpath gawk

Install other dependencies when asked

Setup and compile

setup

@bgotink
bgotink / ._what.md
Last active July 26, 2022 14:13
A small C++ program that converts grayscale EXR to transparent EXR

gray2transparent

This small C++ program converts a grayscale OpenEXR image to an image with transparancy.

behaviour

  • takes only red channel of RGBA into account, prints message if color isn't gray
  • ignores pixels with transparancy already set tot a non-opaque value
  • makes lighter colors more transparant: alpha = 1 - red
@bgotink
bgotink / exportRole.js
Created November 30, 2014 19:18
Helpers when copying existing roles between litus installations
function exportRole() {
var $actions = $('#actions'),
$name = $('#name'),
$parents = $('#parents');
// TODO change to new selectors for dev-form
var result = {};
// extract the name
if ($name.length > 0) {
@bgotink
bgotink / keybase.md
Created March 29, 2015 20:42
keybase.md

Keybase proof

I hereby claim:

  • I am bgotink on github.
  • I am bgotink (https://keybase.io/bgotink) on keybase.
  • I have a public key whose fingerprint is D128 69B0 D750 5125 2312 D9BA B7E1 DF5C AA0E B1A5

To claim this, I am signing this object:

set SSH_ENV $HOME/.ssh/environment
function start_agent
echo "Initializing new SSH agent ..."
ssh-agent -c | sed 's/^echo/#echo/' > $SSH_ENV
echo "succeeded"
chmod 600 $SSH_ENV
. $SSH_ENV > /dev/null
ssh-add
end
@bgotink
bgotink / background-example.bash
Created April 22, 2015 14:19
background-example.bash
background() {
local pidfile="$1"
local logfile="$2"
shift; shift;
echo $BASHPID > "$pidfile"
exec "$@" >"$logfile" 2>&1
}