Skip to content

Instantly share code, notes, and snippets.

View jkramer's full-sized avatar

Jonas Kramer jkramer

View GitHub Profile
module Mud.Thing.Parse where
import Text.ParserCombinators.Parsec
import Mud.Thing.Data
import Mud.Thing.Eval
-- Parse comment (starting with '#' until end of line).
comment = do
#!/usr/bin/perl
# Firefox keeps creating the ~/Desktop directory for some reason whenever the preferences are opened. This little script keeps your $HOME clean until those Mozilla monkeys finally fix that sh*t.
use strict;
use warnings;
use Linux::Inotify2;
my $inotify = new Linux::Inotify2 or die "Narf!\n";
#!/usr/bin/perl
use strict;
use warnings;
use Chart::Pie;
use IO::File;
my $pie = Chart::Pie->new(640, 480);
my $score;
-- ZChart
-- Find the 10 most popular commands from your ZSH history and build a Google
-- Chart from it. Prints the charts URL to stdout and saves it as PNG in
-- "history.png".
import System.IO
import System.Environment
import Data.List
import Data.Char
import Data.String.Utils
import Data.List
import System.Environment
import System.Exit
import System.Cmd
import Control.Concurrent
--
-- This was supposed to be my solution for the Code Golf at Stack Overflow:
-- http://stackoverflow.com/questions/3324301/code-golf-digital-clock
--
-- However, when I finished, that thread was closed and I couldn't post it
-- anymore. :(
--
main = getLine >>= \ n -> mapM_ (\ s -> putStrLn $ d s n) l
@jkramer
jkramer / short.pl
Last active August 29, 2015 14:22
URL Shortener with Mojolicious & Redis
#!/usr/bin/env perl
use strict;
use warnings;
use Mojolicious::Lite;
use Mojo::Redis2;
use Mojo::URL;
use Mojo::Util qw( b64_encode );
@jkramer
jkramer / gist:cf49e7de52cf654d9815
Last active August 29, 2015 14:23
Minimal HTTP service optimized for size for testing deployment of services or something
#include <signal.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <netdb.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <assert.h>
#include <time.h>
@jkramer
jkramer / gist:20ba9f1323988e2dd1af
Created July 9, 2015 10:20
gawk caches output of shell commands
[jkramer/mk-17:~]# <foo.awk
BEGIN {
for(i = 0; i < 5; i++) {
"date +%s" | getline sec
print sec
system("sleep 1")
}
}
[jkramer/mk-17:~]# gawk -f foo.awk
@jkramer
jkramer / truckgen.c
Last active August 29, 2015 14:27
ASCII Truck Generator
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <signal.h>
void print_n(const char *, const char *, const char *, int);
int main(int argc, char ** argv) {
unsigned wheels = 12;
char opt;