Skip to content

Instantly share code, notes, and snippets.

@ChrisPenner
ChrisPenner / Optics Cheatsheet.md
Last active April 12, 2024 14:24
Optics Cheatsheet
@gmpreussner
gmpreussner / archlinux-install-nvme-luks-lvm-btrfs-usb
Last active March 23, 2023 09:31
Minimal instructions for installing a fully encrypted ArchLinux with USB boot on Lenovo Yoga 920.
# Install a fully encrypted ArchLinux on NVMe with detached LUKS
# headers and LUKS encrypted UEFI boot partition on a USB dongle.
#
# Full tutorial can be found here:
# https://headcrash.industries/reference/fully-encrypted-archlinux-with-secure-boot-on-yoga-920/
#
# Written by Gerke Max Preussner <info@headcrash.industries>
# Overview ############################################################
@puffnfresh
puffnfresh / extensions.el
Last active May 31, 2018 09:24
Proof General under spacemacs
(defvar coq-pre-extensions
'(
proof-general
))
(defun coq/init-proof-general ()
"Initialize Proof General"
(use-package proof-site
:defer t
:mode ("\\.v\\'" . coq-mode)
@pixeltrix
pixeltrix / time_vs_datatime.md
Last active August 2, 2024 15:13
When should you use DateTime and when should you use Time?

When should you use DateTime and when should you use Time?

It's a common misconception that [William Shakespeare][1] and [Miguel de Cervantes][2] died on the same day in history - so much so that UNESCO named April 23 as [World Book Day because of this fact][3]. However because England hadn't yet adopted [Gregorian Calendar Reform][4] (and wouldn't until [1752][5]) their deaths are actually 10 days apart. Since Ruby's Time class implements a [proleptic Gregorian calendar][6] and has no concept of calendar reform then there's no way to express this. This is where DateTime steps in:

>> shakespeare = DateTime.iso8601('1616-04-23', Date::ENGLAND)
=> Tue, 23 Apr 1616 00:00:00 +0000
>> cervantes = DateTime.iso8601('1616-04-23', Date::ITALY)
=> Sat, 23 Apr 1616 00:00:00 +0000
@ptrv
ptrv / lldb-gud-emacs-25.patch
Last active October 17, 2017 14:55
lldb-gud patch from llvm.org for emacs 25
diff --git a/lisp/progmodes/gud.el b/lisp/progmodes/gud.el
index 42c5b20..0f6f412 100644
--- a/lisp/progmodes/gud.el
+++ b/lisp/progmodes/gud.el
@@ -35,7 +35,7 @@
;; kluge with the gud-xdb-directories hack producing gud-dbx-directories.
;; Derek L. Davies <ddavies@world.std.com> added support for jdb (Java
;; debugger.) Jan Nieuwenhuizen added support for the Guile REPL (Guile
-;; debugger).
+;; debugger). llvm.org added support for lldb.
@JunichiIto
JunichiIto / alias_matchers.md
Last active September 13, 2024 12:45
List of alias matchers in RSpec 3

This list is based on aliases_spec.rb.

You can see also Module: RSpec::Matchers API.

matcher aliased to description
a_truthy_value be_truthy a truthy value
a_falsey_value be_falsey a falsey value
be_falsy be_falsey be falsy
a_falsy_value be_falsey a falsy value
{
"app/models/*.rb": {
"command": "model",
"affinity": "model",
"alternate": ["unit/models/%s_spec.rb", "spec/models/%s_spec.rb"],
"related": "db/schema.rb#%p",
"template": "class %S\nend"
},
"spec/factories/*_factory.rb": {
..='cd ..'
...='cd ../..'
....='cd ../../..'
.....='cd ../../../..'
......='cd ../../../../..'
a='fasd -a'
ack='noglob ack -i --nogroup'
ai='$(fasd -sia)'
autojump='nocorrect autojump'
b=bg
@wr0ngway
wr0ngway / gc-cow.rb
Created March 23, 2012 17:46
test to see if GC in ruby 2 is truly copy on write friendly
#!/usr/bin/env ruby
rss = '.+?Rss:\s+(\d+)'
share = '.+?Shared_Clean:\s+(\d+)'
share << '.+?Shared_Dirty:\s+(\d+)'
priv = '.+?Private_Clean:\s+(\d+)'
priv << '.+?Private_Dirty:\s+(\d+)'
MEM_REGEXP = /\[heap\]#{rss}#{share}#{priv}/m
def mem_usage_linux
@mmrwoods
mmrwoods / example_migration.rb
Created October 26, 2010 16:38
Rails migration helper for dealing with large tables in MySQL
require "mysql_big_table_migration_helper"
class AddIndexOnSomeColumnToSomeTable < ActiveRecord::Migration
extend MySQLBigTableMigrationHelper
def self.up
add_index_using_tmp_table :some_table, :some_column
end