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 qualified Data.List as L | |
import qualified Control.Monad as C | |
import qualified Network.Memcache as MC | |
import qualified Network.Memcache.Protocol as S | |
setword conn word = do | |
success <- MC.set conn word (1 :: Int) | |
C.when (success == False) $ print word | |
return success |
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
#lang racket | |
(require (planet "memcached.rkt" ("jaymccarthy" "memcached.plt" 1 0))) | |
(define loaddict | |
(lambda (fn) | |
(letrec (;; our input handle | |
[in (open-input-file fn)] | |
;; our memcache conn | |
[mc (memcached "localhost" 11212)] | |
;; our function for walking the file |
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/env perl | |
use v5.12; | |
use warnings; | |
use strict; | |
use Cache::Memcached; | |
my $memd = Cache::Memcached->new(); | |
$memd->set_servers(["localhost:11212"]); | |
open(my $fh,"<","/usr/share/dict/words") || die "open $!"; | |
my $line = <$fh>; # get rid of first empty line |
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 Char | |
f a1 a2 b1 b2 = | |
(a1 == (((a2 + b2 - b1) / 10.0) + b1 - a2) * (-1.0)) && | |
(a2 == ((a2 - a1 - b1) * 10.0) - b2 + b1) && | |
(b1 == (((a2 - a1 - b1) * 10.0) - a2 - b2) * (-1.0)) && | |
(b2 == ((a2 - a1 - b1) * 10) - a2 + b1) | |
-- first line transforms 1978 -> [1.0,9.0,7.0,8.0] |
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
(use readline regex) | |
(current-input-port (make-gnu-readline-port)) | |
(gnu-history-install-file-manager (string-append (or (get-environment-variable "HOME") ".") "/.csi.history")) | |
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
;; php | |
(load "~/.el/lang/php-mode.el") | |
(defun my-php-mode-hook () | |
(c-set-offset 'substatement-open 0) | |
(c-set-offset 'statement-case-open 0) | |
(c-set-offset 'case-label '+) | |
(setq tab-width 4) | |
(setq c-basic-offset 4) | |
(setq c-auto-newline nil) | |
(setq indent-tabs-mode 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
(defun php-delete-trailing-blank-lines () | |
"Deletes all blank lines at the end of the file." | |
(interactive) | |
(save-excursion | |
(save-restriction | |
(widen) | |
(goto-char (point-max)) | |
(delete-blank-lines) | |
(let ((trailnewlines (abs (skip-chars-backward "\n\t")))) | |
(if (> trailnewlines 0) |
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/env perl | |
use v5.14; | |
use warnings; | |
use strict; | |
# this is my password file. yours may be different | |
my $pwfile = $ENV{'HOME'} . '/git/docs/pw/pw.txt.asc'; | |
die $pwfile . ' not readable?' unless (-r $pwfile); | |
# search term required |
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 (main) where | |
import Codec.Crypto.SimpleAES | |
import Data.ByteString.Lazy as L | |
import Data.ByteString.Lazy.Char8 as L8 | |
import Data.ByteString.Char8 as B8 | |
main = do | |
let lstr = L.concat [L8.pack "hi there"] | |
pw = B8.pack "abc123abc1234567" | |
lencode2 <- encryptMsg CBC pw lstr |
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 System.IO | |
import Data.Char | |
import System.Console.ANSI | |
-- ord val of 10 is return key | |
getPW = getPW' "" where | |
getPW' s = getChar >>= \x -> | |
if ((ord x) == 10) then return s | |
else cursorBackward 1 >> putStr "*" >> getPW' (s ++ [x]) |