Skip to content

Instantly share code, notes, and snippets.

@bpd1069
bpd1069 / hack.sh
Created March 31, 2012 15:53 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@bpd1069
bpd1069 / 51-android.rules
Created August 18, 2012 20:57 — forked from johnmurrayvi/51-android.rules
Udev permission for android devices up to and including the grouper (nexus7)
## Acer
#SUBSYSTEM=="usb", ATTR{idVendor}=="0502", MODE="0600", OWNER="<username>"
## ASUS
#SUBSYSTEM=="usb", ATTR{idVendor}=="0b05", MODE="0600", OWNER="<username>"
## Dell
#SUBSYSTEM=="usb", ATTR{idVendor}=="413c", MODE="0600", OWNER="<username>"
## Foxconn
@bpd1069
bpd1069 / README.md
Created October 12, 2013 12:38 — forked from nikcub/README.md
@bpd1069
bpd1069 / getCurrentWindowCWD.sh
Created February 27, 2016 21:09 — forked from TiddoLangerak/getCurrentWindowCWD.sh
Script to get the CWD of the current active window, with support for shells running tmux. This can be used to launch new terminals in the same cwd as the current one.
#!/bin/bash
# i3 thread: https://faq.i3wm.org/question/150/how-to-launch-a-terminal-from-here/?answer=152#post-id-152
# Inspired by https://gist.github.com/viking/5851049 but with support for tmux
CWD=''
# Get window ID
ID=$(xdpyinfo | grep focus | cut -f4 -d " ")
# Get PID of process whose window this is
@bpd1069
bpd1069 / i3-shell.sh
Created February 27, 2016 21:09 — forked from viking/i3-shell.sh
Bash script for i3 to run a terminal in the same working directory as the current focused application
#!/bin/bash
# i3 thread: https://faq.i3wm.org/question/150/how-to-launch-a-terminal-from-here/?answer=152#post-id-152
CMD=xterm
CWD=''
# Get window ID
ID=$(xdpyinfo | grep focus | cut -f4 -d " ")
# Get PID of process whose window this is
@bpd1069
bpd1069 / rw-rootfs
Created March 3, 2016 03:24 — forked from DennisLfromGA/rw-rootfs
A script that asks to make the root filesystem read-writable for subsequent changes and additions by the user.
#!/bin/sh -e
##!! PLEASE USE THIS SCRIPT WITH CAUTION - AND AT YOUR OWN RISK !!##
##!! IT HAS BEEN KNOWN TO CAUSE RESETS AND WIPE DATA ON SOME CHROMEBOXES !!##
APPLICATION="${0##*/}"
ANSWER=''
CURRENTROOT=''
CURRENTKERNEL=''
ROOTDEV=''
ROOTDEVPFX=''
@bpd1069
bpd1069 / gist:5480c3de3d264fc9475c
Created March 28, 2016 15:43 — forked from mgedmin/gist:9547214
Setting up a Jenkins slave on Linux
# This is how you add a Jenkins slave
# On master:
sudo -u jenkins -H ssh-keygen
# On slave
adduser --system --group --home=/var/lib/jenkins-slave --no-create-home --disabled-password --quiet --shell /bin/bash jenkins-slave
install -d -o jenkins-slave -g jenkins-slave /var/lib/jenkins-slave
@bpd1069
bpd1069 / main.go
Created January 7, 2018 15:57 — forked from enricofoltran/main.go
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"

Core Coding Standard

Coding practices are a source of a lot of arguments among programmers. Coding standards, to some degree, help us to put certain questions to bed and resolve stylistic debates. No coding standard makes everyone happy. (And even their existence is sure to make some unhappy.) What follows are the standards we put together on the Core team, which have become the general coding standard for all programming teams on new code development. We’ve tried to balance the need for creating a common, recognizable and readable code base with not unduly burdening the programmer with minor code formatting concerns.

Table Of Contents

@bpd1069
bpd1069 / hilbert.c
Created March 11, 2018 14:16 — forked from jbedo/hilbert.c
Matrix multiplication with Hilbert space-filling curves
#include<u.h>
#include<libc.h>
#define MAX(a, b) ((a) > (b) ? (a) : (b))
/* Hilbert curve functions (from Wikipedia) */
/* rotate/flip a quadrant appropriately */
void rot(int n, int *x, int *y, int rx, int ry)
{