Skip to content

Instantly share code, notes, and snippets.

@PkmX
PkmX / Main.hs
Created October 6, 2012 02:31
strobogrammatic numbers
import Control.Applicative
import Control.Monad
import Control.DeepSeq
import Data.List
import System.Environment
--
{-
strobo' :: Int -> [String]
@PkmX
PkmX / _srandr
Created October 13, 2012 11:53
srandr
#compdef srandr
_arguments "1: :(lvds vga lvds-vga vga-lvds mirror debug)"
@PkmX
PkmX / clone
Created October 30, 2012 13:41
clone
#!/usr/bin/env bash
tee >(cat >&2)
! urxvt {{{
urxvt*scrollBar: off
urxvt*urgentOnBell: true
urxvt*font: xft:Monospace:size=9,xft:WenQuanYi Micro Hei Mono:size=9
urxvt*perl-lib: /usr/lib/urxvt/perl/
urxvt*perl-ext-common: default,matcher,clipboard
urxvt*matcher.button: 1
urxvt*urlLauncher: chromium
@PkmX
PkmX / kerker.scala
Last active December 10, 2015 16:38
class Foo[A, B] {
def apply(f: (A) => Unit) {}
// Not OK! Duplicate method after type erasure.
// def apply(f: (B) => Unit) {}
// OK, but seriously, scala?
def apply(f: (B) => Unit)(implicit dummy: DummyImplicit) {}
}
#ifndef SCOPEGUARD_HPP
#define SCOPEGUARD_HPP
#include <functional>
#ifndef __has_feature
#define __has_feature(x) 0
#endif
namespace detail
#include <vector>
#include <boost/strong_typedef.hpp>
BOOST_STRONG_TYPEDEF(std::vector<std::vector<int>>, bitmap)
BOOST_STRONG_TYPEDEF(std::vector<std::vector<int>>, heightmap)
bitmap load_dog_sprite()
{
return {};
}
@PkmX
PkmX / gist:5730947
Last active December 18, 2015 05:09
import Control.Applicative ((<$>))
import Data.Function (on)
import Data.List (find, nubBy)
import Data.List.Utils (split)
import Data.Maybe (fromMaybe)
import Data.Ord (comparing)
import System.Environment (getArgs)
import System.IO (stdin, hGetContents, openFile, IOMode(ReadMode))
data SetOp = SetRow { row :: Int, val :: Int } | SetCol { col :: Int, val :: Int }
@PkmX
PkmX / tbf.cpp
Last active December 21, 2015 14:09
Using C++ template meta-programming to transform Brainfuck program into a C++ function.
// WTFPL, PkmX, 2013
// Using C++ template meta-programming to transform Brainfuck program into a C++ function.
#include <iostream>
#include <vector>
template<char... C>
struct source;
////////////////////////////////////////////////////////////////////////////////
@PkmX
PkmX / PKGBUILD
Last active August 29, 2015 13:57
Doomseeker
# Maintainer: Robert La Spina <rkidlaspina [at] gmail [dot] com>
# Contributor: MP2E <MP2E {AT] archlinux.us>
# Contributor: PkmX <[email protected]>
#
# TODO: Find a way to put engine plugins in /usr/lib/$pkgname.
pkgname=doomseeker
pkgver=0.11.1b
pkgrel=1
pkgdesc='A cross-platform server browser for various multiplayer Doom source-ports.'