Skip to content

Instantly share code, notes, and snippets.

View jkramer's full-sized avatar

Jonas Kramer jkramer

View GitHub Profile
@jkramer
jkramer / 6210001000.p6
Last active January 6, 2016 11:05
A program that prints the number 6210001000 really fast.
#!/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 January 5, 2016 14:16
Two-legged OAuth for Mojo::UserAgent
package Mojo::UserAgent::OAuth;
use Mojo::Base -base;
use Mojo::URL;
use Net::OAuth;
our $VERSION = 0.01;
--
-- 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
import Data.Char
import Data.String.Utils
import Data.List
import System.Environment
import System.Exit
import System.Cmd
import Control.Concurrent
#!/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
#!/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";
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
@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;
@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