This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| ls /var/cache/pacman/pkg | | |
| awk -F - ' | |
| { | |
| k = "" | |
| for (i = 1; i < NF - 2; ++i) | |
| k = k $i "-" | |
| sub(/-$/, "", k) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Common pattern for searching file contents | |
| fxg () { | |
| local OPTIND=1 findbase=. grepflags verbose=false usage=false | |
| while getopts b:g:vh opt; do | |
| case $opt in | |
| b) findbase=$OPTARG ;; | |
| g) grepflags=$OPTARG ;; | |
| v) verbose=true ;; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Print Dungeon Crawl Stone Soup high score list | |
| { | |
| echo ' |Score|Name|Level|Type|Religion|Runes Ascended' | |
| for f in `ls -tr ~/.crawl/morgue/morgue-*.txt`; do | |
| sed -nr ' | |
| 3{ | |
| s/([0-9]+)./\1|/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| parse_git_branch () { | |
| local stat | |
| if ! stat=`git status -sb 2>/dev/null` || [[ -n $NO_GIT_PROMPT ]]; then | |
| return | |
| fi | |
| local ref=`sed -nr '/^##/{s/^## (Initial commit on )?//;p}' <<<"$stat"` | |
| local dirty=` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| " Jump backwards or forwards through the jump list one buffer at a time, | |
| " rather than one jump at a time. | |
| " | |
| " Use <Leader>o to jump backwards and <Leader>i to jump forwards | |
| let s:JUMPLIMIT = 100 | |
| if exists('g:loaded_jump_buf') && loaded_jump_buf | |
| finish | |
| endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {-# LANGUAGE FlexibleInstances, Rank2Types, TypeFamilies #-} | |
| module ChurchBool where | |
| type CB = forall a. a -> a -> a | |
| instance a ~ Bool => Show (a -> a -> a) where | |
| show cb = if cb True False then "cTrue" else "cFalse" | |
| cTrue, cFalse :: CB |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <SDL/SDL.h> | |
| int main(void) | |
| { | |
| SDL_Surface *main_surf; | |
| SDL_Event *const ev = malloc(sizeof (SDL_Event)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {-# LANGUAGE TemplateHaskell #-} | |
| module THOp (mkOps) where | |
| import Control.Monad | |
| import Language.Haskell.TH | |
| mkOp :: String -> Q [Dec] | |
| mkOp n = [| $(varE a) + $(varE b) + length (filter (=='-') n) |] >>= \body -> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {- | |
| - Count how many numbers with no repeated digits lie between 1 and the | |
| - specified maximum (given as a command line argument) | |
| - | |
| - For instance 183957 is counted, while 298387 is not ('8' occurs twice). | |
| - | |
| - On SMP systems, parallelism is exploited to speed up the computation | |
| - significantly. The search space is divided into as many evenly-sized chunks | |
| - as the host system has cores, and worker threads are spawned to run on each | |
| - core. This small program is primarily intended to illustrate the usage of |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {-# LANGUAGE FlexibleInstances | |
| , MultiParamTypeClasses | |
| , TemplateHaskell | |
| , TypeSynonymInstances #-} | |
| {-# OPTIONS_GHC -fno-warn-orphans #-} | |
| import Prelude hiding (print) | |
| import AdvancedOverlap |