Skip to content

Instantly share code, notes, and snippets.

Jonas Kramer jkramer

  • Berlin, Germany
Block or report user

Report or block jkramer

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jkramer
jkramer / short.pl
Last active Aug 29, 2015
URL Shortener with Mojolicious & Redis
View short.pl
#!/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 Aug 29, 2015
Minimal HTTP service optimized for size for testing deployment of services or something
View gist:cf49e7de52cf654d9815
#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 Jul 9, 2015
gawk caches output of shell commands
View gist:20ba9f1323988e2dd1af
[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 Aug 29, 2015
ASCII Truck Generator
View truckgen.c
#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;
View gist:129625
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
View Firefox Desktop Fuckup
#!/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";
View ZChart.hs
-- 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
View chart.pl
#!/usr/bin/perl
use strict;
use warnings;
use Chart::Pie;
use IO::File;
my $pie = Chart::Pie->new(640, 480);
my $score;
View hscrack.hs
import Data.Char
import Data.String.Utils
import Data.List
import System.Environment
import System.Exit
import System.Cmd
import Control.Concurrent
View Digital Clock
--
-- 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
You can’t perform that action at this time.