Skip to content

Instantly share code, notes, and snippets.

View relrod's full-sized avatar

Rick Elrod relrod

View GitHub Profile
@relrod
relrod / sine.hs
Last active August 26, 2015 04:36
Playing around with audio
module Main where
import Data.Binary.Put
import qualified Data.ByteString.Lazy as BL
import Data.Word
newtype Seconds = Seconds Double
newtype Hertz = Hertz Double
sampleRate :: Double
@relrod
relrod / caesar.hs
Last active August 29, 2015 14:26
A quick and hacky program I threw together fo taking the caesar-shift cipher of a string 25 times. Used for the MathFest Dash scavenger hunt.
{-# LANGUAGE OverloadedStrings #-}
import Data.Function (on)
import qualified Data.ByteString.Lazy.Char8 as B
import Crypto.Classical
import System.Environment
import qualified Data.Text.Lazy as T
import qualified Data.Text.Lazy.IO as T
import Data.Char (toLower, isAlpha)
import Data.List
λ> dist euclidean (V.fromList [-3.9295649822650747]) (V.fromList [8.948812983847764]) <= dist euclidean (V.fromList [-3.9295649822650747]) (V.fromList [1.5350626474279276]) + dist euclidean (V.fromList [1.5350626474279276]) (V.fromList [8.948812983847764])
False
it :: Bool
λ> dist euclidean (V.fromList [-3.9295649822650747]) (V.fromList [8.948812983847764])
12.87837796611284
it :: Double
λ> dist euclidean (V.fromList [-3.9295649822650747]) (V.fromList [1.5350626474279276]) + dist euclidean (V.fromList [1.5350626474279276]) (V.fromList [8.948812983847764])
12.878377966112838
it :: Double
git ricky@t520 99% ~/devel/fedora/haskell/pagure-haskell (hooktest)$ git commit -sm 'test commit'
gi[hooktest 3da9265] test commit
1 file changed, 1 insertion(+)
ricky@t520 99% ~/devel/fedora/haskell/pagure-haskell (hooktest)$ git push origin hooktest
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 308 bytes | 0 bytes/s, done.
Total 3 (delta 2), reused 0 (delta 0)
remote: Emitting a message to the fedmsg bus.
@relrod
relrod / gist:232cbc526f676ac25780
Created June 4, 2015 07:01
This is that flexibility thing that Scala folks always talk about, right? ;) (aka I finally decided to learn about TypeFamilies, then had some fun)
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE RebindableSyntax #-}
module Foo where
import Prelude hiding ((+), Num(..))
import qualified Prelude as P
@relrod
relrod / gist:1f580c6530ad6d1f5467
Created April 29, 2015 01:03
Beautiful segfault there.
Apr 28 21:00:39 t520 kernel: [379739.301442] nm-applet[3307]: segfault at 30 ip 00007fee9aaf9e72 sp 00007fff71056580 error 4 in libnm-glib.so.4.8.0 (deleted)[7fee9aae8000+46000]
Apr 28 21:00:39 t520 /etc/gdm/Xsession: (nm-applet:3307): GLib-GObject-CRITICAL **: g_type_instance_get_private: assertion 'instance != NULL && instance->g_class != NULL' failed
Apr 28 21:00:39 t520 kernel: nm-applet[3307]: segfault at 30 ip 00007fee9aaf9e72 sp 00007fff71056580 error 4 in libnm-glib.so.4.8.0 (deleted)[7fee9aae8000+46000]
Apr 28 21:00:40 t520 /etc/gdm/Xsession: <file descriptor: 4>: commitBuffer: resource vanished (Broken pipe)
Apr 28 21:00:40 t520 /etc/gdm/Xsession: <file descriptor: 4>: commitBuffer: resource vanished (Broken pipe)
Apr 28 21:00:40 t520 /etc/gdm/Xsession: <file descriptor: 4>: commitBuffer: resource vanished (Broken pipe)
Apr 28 21:00:40 t520 /etc/gdm/Xsession: <file descriptor: 4>: commitBuffer: resource vanished (Broken pipe)
Apr 28 21:00:40 t520 /etc/gdm/Xsession: <file descriptor: 4>: commitBuffer
@relrod
relrod / gist:971548c7bd98f18cacec
Created March 28, 2015 05:25
GitHub assets 503
ricky@t520 99% ~$ curl -svo /dev/null https://assets-cdn.github.com/assets/github-6337179a282bad7457c5b97336a91ca3743e26d9564ce4c54d4baef4163fc364.css
* Hostname was NOT found in DNS cache
* Trying 199.27.75.133...
* Connected to assets-cdn.github.com (199.27.75.133) port 443 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
* CAfile: /etc/ssl/certs/ca-bundle.crt
CApath: none
* SSL connection using TLS_RSA_WITH_AES_128_GCM_SHA256
* Server certificate:
* subject: CN=www.github.com,O="Fastly, Inc.",ST=California,L=San Francisco,C=US
ricky@t520 99% ~/devel/fedora/packages/minimodem (f21)$ fedpkg -v build
Creating repo object from /home/ricky/devel/fedora/packages/minimodem
Initiating a koji session to http://koji.fedoraproject.org/kojihub
Could not execute build: [('SSL routines', 'SSL3_WRITE_BYTES', 'ssl handshake failure')]
Traceback (most recent call last):
File "/usr/bin/fedpkg", line 16, in <module>
main()
File "/usr/lib/python2.7/site-packages/fedpkg/__main__.py", line 68, in main
sys.exit(client.args.command())
File "/usr/lib/python2.7/site-packages/pyrpkg/cli.py", line 930, in build
@relrod
relrod / gist:97fc983492868bbb01cb
Created March 8, 2015 20:29
Part of why I use xmonad instead of Gnome.
ricky@t520 100% /tmp$ cloc --quiet gnome-desktop-3.15.91/libgnome-desktop/*
http://cloc.sourceforge.net v 1.62 T=0.14 s (325.7 files/s, 160673.8 lines/s)
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
C 24 2746 3089 13576
C/C++ Header 18 414 346 1527
make 1 35 0 139
XML 2 44 218 66
@relrod
relrod / foo.v
Created January 15, 2015 16:59
Proving de Morgan's laws in Coq because I have no life.
Theorem de_morgan_1 : forall b1 b2 : bool,
negb (orb b1 b2) = andb (negb b1) (negb b2).
Proof.
intros.
destruct b1.
simpl.
reflexivity.
simpl.
reflexivity.
Qed.