Skip to content

Instantly share code, notes, and snippets.

naomik /
Last active Oct 28, 2020
create a simple LUKS partition on a single physical volume

LUKS crypt

In this guide, I'm going to setup a keyfile-encrypted LUKS partition. I will be using a single, max-size partition on a single physical device. My physical device is located at /dev/sde

partition the physical device

parted /dev/sde
naomik / benchable.rb
Last active Aug 19, 2020
Benchable Ruby module
View benchable.rb
require 'benchmark'
module Benchable
def benchmark width = 15 do |b| do |kase| kase do
method(kase) { nil }
naomik /
Created Apr 24, 2014 — forked from lukehefson/
Completely uninstall GitHub for Mac
function remove_dir () {
rm -rf "$1_"
if [ -d "$1" ]
mv "$1" "$1_"
naomik /
Last active Jul 15, 2020
Install HPN-SSH
View output.txt
0.02 995020 neutral (30.0585%)
0.03 999855 neutral (31.7498%)
0.04 1000336 neutral (31.9181%)
0.05 998964 neutral (31.4381%)
0.06 1000716 neutral (32.0510%)
0.07 999918 neutral (31.7719%)
0.08 1000260 neutral (31.8915%)
0.09 1001450 neutral (32.3078%)
0.10 998509 neutral (31.2790%)
0.11 999876 neutral (31.7572%)
naomik / bind.rb
Last active Dec 5, 2016
Function.prototype.bind in Ruby. I'm so happy right now.
View bind.rb
class Method
def bind *args do |*more| *(args + more)
def foo a, b, c, d, e, f, x=100, y=200, z=300
puts a, b, c, d, e, f, x, y, z

Keybase proof

I hereby claim:

  • I am naomik on github.
  • I am naomik ( on keybase.
  • I have a public key ASAjDBN1U4ilDQA9PRSSs9BegwXOytlWMQSTtYIzOPb1Two

To claim this, I am signing this object:

naomik / accepted_locales.rb
Created May 9, 2013
because plugins and gems are dependencies and dependencies are bad
View accepted_locales.rb
# returns an descending ranked array of language preferences in IS0-639-1
# parse('en-US,en-GB;q=0.9,es-MX;q=0.8,de-DE;q=0.7')
# => [:en, :en, :es, :de]
def accepted_locales http_accept_language
return [] if http_accept_language.blank?
langs = http_accept_language.scan(/([a-zA-Z]{2,4})(?:-[a-zA-Z]{2})?(?:;q=(1|0?\.[0-9]{1,3}))?/).map do |pair|
lang, q = pair
[lang.to_sym, (q || '1').to_f]
langs.sort_by { |lang, q| q }.map { |lang, q| lang }.reverse
naomik / advanced.c
Last active Apr 20, 2016
function pointers! in C!
View advanced.c
#include <stdio.h>
typedef struct {
int (*multiply)(int);
} multiplier_t;
int multiplyBy5(int i) {
return i * 5;
View gist:cebe70c2835122ea6a6c

So, you want to send a motherfucking XMLHttpRequest (XHR, or commonly and falsly known as AJAX.) Too bad, just ran out of motherfucking XMLHttpRequests; but I still have one regular. XHR is not magic. It does not autofuckinmagically send things the way you want them do be sent. It does not do the thinking for you. It just sends an Http Request.

You get a hold on such a prime beast like this:

You can’t perform that action at this time.