Skip to content

Instantly share code, notes, and snippets.

@hardentoo
hardentoo / _gvimrc
Created November 17, 2017 10:53 — forked from GopinathMR/_gvimrc
GVim config file (for both Windows and Unix)
" Gopi's _gvimrc file https://github.com/GopinathMR
" This file has been modified to make it work on both Windows and Linux
" Github gist location : https://gist.github.com/1100054
" If you find any issues or add any enhancements, please submit revised version as gist
"----------------------------------------------------------------------------------------------------------
" 1. OS specific
if ($OS == 'Windows_NT')
" Windows specific settings
@hardentoo
hardentoo / fullscreen.pl
Created November 19, 2017 01:27
urxvt-fullscreen
#! perl
sub on_user_command {
my ($self, $cmd) = @_;
if ($cmd eq "fullscreen:switch") {
my $dummy = `wmctrl -r :ACTIVE: -b toggle,fullscreen` ;
}
}
@hardentoo
hardentoo / trolling_haskell
Created November 28, 2017 08:48 — forked from quchen/trolling_haskell
Trolling #haskell
13:15 <xQuasar> | HASKELL IS FOR FUCKIN FAGGOTS. YOU'RE ALL A BUNCH OF
| FUCKIN PUSSIES
13:15 <xQuasar> | JAVASCRIPT FOR LIFE FAGS
13:16 <luite> | hello
13:16 <ChongLi> | somebody has a mental illness!
13:16 <merijn> | Wow...I suddenly see the error of my ways and feel
| compelled to write Node.js!
13:16 <genisage> | hi
13:16 <luite> | you might be pleased to learn that you can compile
| haskell to javascript now
@hardentoo
hardentoo / imperative.lhs
Created December 17, 2017 06:05 — forked from gatlin/imperative.lhs
Imperative Programming in Haskell
How to add imperative programming to a pure functional language
===
Many people bemoan languages such as Haskell for not supporting imperative
programming; they decry the need for math in their computer science.
![Math? In my computer? Yeah right.](http://i.imgur.com/YDIaEPB.jpg)
I'm here to tell you that not only does Haskell make imperative programming a
cinch, but safe and correct as well. Follow along! This post is written in
@hardentoo
hardentoo / Newtonian.hs
Created December 24, 2017 16:51 — forked from kazimuth/Newtonian.hs
A universe in 125 lines of haskell
--A universe in 125 lines of haskell: http://i.imgur.com/9dJdaV1.png
--Note: I had made a better version but that computer died :/
--to build: cabal install random gloss && ghc -O3 -threaded Newtonian.hs && ./Newtonian
import Graphics.Gloss
import Graphics.Gloss.Data.Picture
import Graphics.Gloss.Data.Vector
import Graphics.Gloss.Interface.Pure.Simulate
import Data.List
import System.Random
@hardentoo
hardentoo / demo1A.agda
Created March 12, 2018 01:17 — forked from sordina/demo1A.agda
A quick introduction to Agda
-- Hello Agda Enthusiasts!
-- Let's play with Agda.
-- Firstly, since we're editing demo1A.agda, let's name our module correctly:
module demo1A where -- Load the file with C-c C-l - Like that!
-- Syntax is highlighted by Emacs
@hardentoo
hardentoo / Life.hs
Created March 12, 2018 01:18 — forked from sordina/Life.hs
Small game of life implementation
import Data.List
import Control.Arrow
import System.Random
-- Core Life Engine
life = f 3 >>> map (map (q 3 >>> uncurry s))
s n 1 | n < 3 = 0 -- There is no 'off-by-one' error here
@hardentoo
hardentoo / freer.hs
Created March 12, 2018 01:53 — forked from sordina/freer.hs
Excerpts from Oleg's Freer Monads - http://okmij.org/ftp/Haskell/extensible/more.pdf
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE TypeOperators #-}
import Control.Monad
{-
@hardentoo
hardentoo / Groebner.hs
Created March 15, 2018 01:31 — forked from maksbotan/Groebner.hs
Source code for Groebner bases implementation in Haskell
import Data.List (intercalate, foldl')
data Monom c a = M c [a] deriving (Eq)
newtype Polynom c a = P [Monom c a] deriving (Eq)
instance (Eq c, Ord a) => Ord (Monom c a) where
compare (M _ asl) (M _ asr) = compare asl asr
instance (Show a, Show c, Num a, Num c, Eq a, Eq c) => Show (Monom c a) where
@hardentoo
hardentoo / fib.hs
Created March 15, 2018 04:41 — forked from gdejohn/fib.hs
Point-free nth Fibonacci number
import Control.Arrow ((&&&))
fib = fst . (iterate (snd &&& uncurry (+)) (0, 1) !!)