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 / 6210001000.p6
Last active Jan 6, 2016
A program that prints the number 6210001000 really fast.
View 6210001000.p6
#!/usr/bin/env perl6
my Int @digits = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
loop {
my $changed = False;
for [0..9] -> $digit {
my $count = @digits.grep($digit).elems;
@jkramer
jkramer / Mojo-UserAgent-OAuth.pm
Last active Jan 5, 2016
Two-legged OAuth for Mojo::UserAgent
View Mojo-UserAgent-OAuth.pm
package Mojo::UserAgent::OAuth;
use Mojo::Base -base;
use Mojo::URL;
use Net::OAuth;
our $VERSION = 0.01;
@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;
@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 / 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 / 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 );
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
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 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;
You can’t perform that action at this time.