Skip to content

Instantly share code, notes, and snippets.

View clockfort's full-sized avatar
✔️

Chris Lockfort clockfort

✔️
View GitHub Profile
@clockfort
clockfort / xkcd-calendar.hs
Created May 28, 2012 15:27
xkcd calendar calculator
import Data.Numbers.Primes
second = 1
minute = 60*second
hour = 60*minute
day = 1444*minute
month = 30*day
year = 12*month
daysPerXKCDYear = 30*12
@clockfort
clockfort / xkcd-calendar.hs
Created May 28, 2012 17:00 — forked from ryantenney/xkcd-calendar.hs
xkcd calendar calculator
import Data.Numbers.Primes
second = 1
minute = 60*second
hour = 60*minute
day = 1444*minute
month = 30*day
year = 12*month
daysPerXKCDYear = 30*12
[root@jolt clockfort]# smartctl --all /dev/sdg | grep "Device Model"
Device Model: ST3000DM001-9YN166
[root@jolt clockfort]# smartctl --all /dev/sda | grep "Device Model"
Device Model: ST3000DM001-9YN166
[root@jolt clockfort]# smartctl --all /dev/sda | grep Capacity
User Capacity: 3,000,592,982,016 bytes
[root@jolt clockfort]# smartctl --all /dev/sdg | grep Capacity
User Capacity: 3,000,592,982,016 bytes
[root@jolt clockfort]# cat /proc/mdstat
Personalities : [raid1] [raid6] [raid5] [raid4]
@clockfort
clockfort / ghci_log.txt
Last active December 18, 2015 08:29
reddit r/codes/
[Prelude] λ> import Data.Char
[Prelude Data.Char] λ> let fibs = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233]
[Prelude Data.Char] λ> let mystery = [6, 9, 4, 45, 70, 8, 39, 63, 306 ]
[Prelude Data.Char] λ> map (chr . (+64) . fromInteger) $ zipWith (div) mystery fibs
"FIBONACCI"
@clockfort
clockfort / haskell squares
Created July 16, 2013 18:38
show gambogi powers in haskell and their relative speed in square case
Prelude> sum $ map (\n -> n*n) [1..1024*1024*10]
384307223177865461760
it :: Integer
(5.20 secs, 3756611120 bytes)
Prelude> sum $ map (\n -> n**2) [1..1024*1024*10]
3.843072231783101e20
it :: Double
(5.65 secs, 3960924248 bytes)
Prelude> sum $ map (\n -> n^2) [1..1024*1024*10]
384307223177865461760
@clockfort
clockfort / gist:6331037
Last active December 21, 2015 16:08
oneblox issues
4+0 records out
33554432 bytes (34 MB) copied, 815.963 s, 41.1 kB/s
4+0 records in
4+0 records out
33554432 bytes (34 MB) copied, 795.58 s, 42.2 kB/s
4+0 records in
4+0 records out
33554432 bytes (34 MB) copied, 829.277 s, 40.5 kB/s
4+0 records in
4+0 records out
@clockfort
clockfort / gist:6447201
Last active December 22, 2015 08:48
wtf btrfs resize my filesystem
root@jolt ~# btrfs fi df /mnt/clockfort
Data: total=6.34TB, used=6.34TB
System, DUP: total=32.00MB, used=768.00KB
System: total=4.00MB, used=0.00
Metadata, DUP: total=38.00GB, used=14.75GB
root@jolt ~# btrfs fi resize max /mnt/clockfort/ && dmesg | tail -n 1
Resize '/mnt/clockfort/' of 'max'
btrfs: new size for /dev/mapper/vg_raid6_array-lv_clockfort is 8796093022208
@clockfort
clockfort / gist:6470270
Created September 6, 2013 21:30
uhhhhh btrfs what are you doing btrfs stop
clockfort@jolt ~$ btrfs filesystem df /mnt/clockfort/
Data: total=6.24TB, used=6.05TB
System, DUP: total=32.00MB, used=736.00KB
System: total=4.00MB, used=0.00
Metadata, DUP: total=30.00GB, used=13.83GB
clockfort@jolt ~$ df -h /mnt/clockfort/
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_raid6_array-lv_clockfort
9.0T 6.1T 910G 88% /mnt/clockfort
@clockfort
clockfort / gist:6584317
Created September 16, 2013 18:10
I have scared NTP in submission. (and/or woke up its process with a signal)
clockfort@clockfort-linux:~$ minions db date
root@db1: Mon Sep 16 18:01:43 UTC 2013
root@db3: Mon Sep 16 18:01:46 UTC 2013
root@db4: Mon Sep 16 18:01:46 UTC 2013
root@db2: Mon Sep 16 18:01:46 UTC 2013
clockfort@clockfort-linux:~$ ssh root@db1 /etc/init.d/ntpd status
ntpd (pid 3018) is running...
clockfort@clockfort-linux:~$ minions db date
@clockfort
clockfort / Main.java
Created September 18, 2016 07:04
BinaryReverseGrayCodeRotaryEncoderGenerator
package com.clockfort;
import com.google.common.base.Joiner;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;