Skip to content

Instantly share code, notes, and snippets.

View noahmorrison's full-sized avatar

Noah Morrison noahmorrison

View GitHub Profile
@noahmorrison
noahmorrison / leven.lisp
Created November 22, 2014 01:15
Levenshtein distance in lisp (Recursive/slow)
(defun leven-distance (string1 string2)
(if (= (length string1) 0)
(length string2)
(if (= (length string2) 0)
(length string1)
(min (+ (leven-distance (subseq string1 0 (- (length string1) 1))
string2)
1)
@noahmorrison
noahmorrison / .bashrc
Created November 25, 2014 16:02
Gitignore integrated ls
ls_alias="ls --color=auto"
while read line
do
if [[ $line ]] && [[ ${line:0:1} != '#' ]]
then
export ls_alias+=" -I \"$line\""
fi
done < ~/.gitignore
alias ls=$ls_alias
@noahmorrison
noahmorrison / battery
Last active July 8, 2022 19:30
Bar for bspwm
#!/bin/sh
sc () {
if [ $COLOR = "bar" ] ; then
case $2 in
bold) case $1 in
black) echo "%{F#FF000000}";;
red) echo "%{F#FFFF0000}";;
green) echo "%{F#FF00FF00}";;
yellow) echo "%{F#FFFF4500}";;
@noahmorrison
noahmorrison / dopen
Created December 9, 2014 04:41
Open desktop files using dmenu
#!/bin/sh
bin="/usr/share/applications"
app=`ls --color=never -1 $bin | grep -e ".desktop\$" | rev | cut -c 9- | rev | dme
path="$bin/${app}.desktop"
grep '^Exec' $path | tail -1 | sed 's/^Exec=//' | sed 's/%.//' | sh
static class Program
{
static void Main()
{
long theAmountOfTicksItTakesToGetToTheCurrentTime_MultiplyBy_TimeSpanDotTicksPerMillisecond_ToGetCurrentTimeInMilliseconds__NoteThatWouldNotBeEqualToTheTimeSinceTheEpoch
= DateTime.Now.Ticks;
float aFloatThatIsWasImplicitlyCastedFromALongAndLossDataInTheProcess_IsEqualTo6Dot35712541EPlus17
= theAmountOfTicksItTakesToGetToTheCurrentTime_MultiplyBy_TimeSpanDotTicksPerMillisecond_ToGetCurrentTimeInMilliseconds__NoteThatWouldNotBeEqualToTheTimeSinceTheEpoch
+ 10;
@noahmorrison
noahmorrison / DictionaryOrderTest.cs
Last active August 29, 2015 14:24
C# dictionary ordering
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DictionaryOrderTest
{
class Program
{
static void Main(string[] args)
#include <stdio.h>
int main(int argc, char *argv[])
{
printf("Language: C\n");
printf("%d\n", fib(atoi(argv[1])));
return 0;
}
int fib(int n)
@noahmorrison
noahmorrison / keybase.md
Created February 11, 2017 20:44
For proving identity on keybase.io

Keybase proof

I hereby claim:

  • I am noahmorrison on github.
  • I am noahmorrison (https://keybase.io/noahmorrison) on keybase.
  • I have a public key whose fingerprint is B45C 0F11 420C A4C9 AE46 BC30 BF15 41E1 682E 168F

To claim this, I am signing this object:

GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
2538888 files found
16823 files ignored
Chunk: 168096 files - 49.0 G
Chunk: 136788 files - 49.0 G
Chunk: 57117 files - 49.0 G
Chunk: 149576 files - 49.0 G
Chunk: 123962 files - 46.0 G
Chunk: 363260 files - 49.0 G
Chunk: 169133 files - 49.0 G
Chunk: 348598 files - 49.0 G