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
| package main | |
| import ( | |
| "fmt" | |
| "time" | |
| ) | |
| func main() { | |
| c := make(chan struct{},1) | |
| go func() { |
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
| package main | |
| import ( | |
| "errors" | |
| "log" | |
| ) | |
| func final() { | |
| log.Printf("cleaning up") | |
| if c := recover(); c != nil { |
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
| package main | |
| import ( | |
| "log" | |
| "net" | |
| "net/http" | |
| "github.com/bradclawsie/httpdshutdown" | |
| "os" | |
| "os/signal" | |
| "time" | |
| ) |
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
| #!/usr/bin/perl | |
| use Cwd; | |
| use Env; | |
| use File::Copy; | |
| use v5.20; | |
| my $argc = scalar @ARGV; | |
| die "use gp.pl basepath reponame" unless ($argc == 2); | |
| my $base = $ARGV[0]; | |
| my $repo = $ARGV[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
| module Main where | |
| import Prelude as P | |
| import Control.Monad as M | |
| import Data.Text as T | |
| import Data.Text.Read as TR | |
| import Data.Either as E | |
| import Data.List as L | |
| import Data.Maybe as MB | |
| -- http://programmingpraxis.com/2015/06/26/find-the-missing-number/ |
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
| package main | |
| import ( | |
| "bufio" | |
| "compress/gzip" | |
| "fmt" | |
| "io" | |
| "io/ioutil" | |
| "log" | |
| "net/http" |
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
| package main | |
| import ( | |
| "fmt" | |
| "os" | |
| "time" | |
| "net/http" | |
| "encoding/json" | |
| "github.com/smugmug/godynamo/conf" |
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 <string.h> | |
| int ss(char *n, char *h) { | |
| const size_t n_len = strlen(n); | |
| // empty needle is in haystack | |
| if (n_len == 0) return 1; | |
| const size_t h_len = strlen(h); | |
| // needle cannot be longer than haystack |
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
| substring a b = ss a b | |
| where | |
| ss (x:xs) (y:ys) = if (x == y) then ss xs ys else substring a ys | |
| ss (x:xs) _ = False | |
| ss _ _ = 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
| data Tree = Empty | Node Tree Int Tree deriving (Show) | |
| insert n Empty = Node Empty n Empty | |
| insert n (Node l i r) = if n <= i then Node (insert n l) i r else Node l i (insert n r) |