This file contains 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
import Network.Socket as N | |
import Control.Concurrent | |
serverPort :: PortNumber | |
serverPort = 8080 | |
main = do | |
sock <- N.socket N.AF_INET6 N.Stream N.defaultProtocol | |
N.setSocketOption sock N.ReuseAddr 1 | |
N.setSocketOption sock N.ReusePort 1 |
This file contains 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
{- | |
File: Lockpattern.hs | |
This programm calculates a pattern for the 3x3 lock screen in Android | |
devices. It outputs the path in form of a matrix with numbered | |
finger positions. | |
-} | |
import System.Random |
This file contains 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
import System.Posix.PAM | |
main = do | |
res <- authenticate "system" "user" "pass" | |
case res of | |
Left a -> putStrLn $ "error: " ++ pamCodeToMessage a | |
Right () -> putStrLn "success" |
This file contains 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
import System.IO.Error | |
import System.Posix.Process | |
import Graphics.X11.Xft | |
import Graphics.X11.Xlib.Context | |
import Graphics.X11.Xlib.Display | |
import Graphics.X11.Xlib.Event | |
import Graphics.X11.Xlib.Misc | |
import Graphics.X11.Xlib.Screen | |
import Graphics.X11.Types | |
import Graphics.X11.Xlib.Window |
This file contains 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
-- return the nth fibonacci number | |
fib n = fst $ (foldr1 (.) (replicate n $ \(f1, f2) -> (f2, f1 + f2) )) (0,1) |
This file contains 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
" ***** Start project directory local vimrc files | |
let s:start_dir=getcwd() | |
while s:start_dir != '/' && empty(glob(s:start_dir . '/.git')) | |
let s:start_dir=fnamemodify( s:start_dir, ':h') | |
endwhile | |
if s:start_dir != '/' | |
let s:vimrc_path = s:start_dir . '/.vimrc' |
This file contains 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> | |
int is_little_endian(void) | |
{ | |
char buf[sizeof(unsigned int)]; | |
*(unsigned int *)buf = 1u; | |
return (int)buf[0]; | |
} |
This file contains 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> | |
int main(void) | |
{ | |
int found_non_ascii = 0; | |
while (!ferror(stdin) && !feof(stdin)) { | |
size_t s; |
This file contains 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/sh | |
IRCSERVER="$1" | |
CHANNEL="$2" | |
TEXT="$3" | |
WEECHAT_PID=`pgrep -U weechatuser weechat` | |
WEECHAT_PIPE="/home/weechatuser/.weechat/weechat_fifo_${WEECHAT_PID}" | |
if [ -p "$WEECHAT_PIPE" ]; then | |
echo "irc.$IRCSERVER.$CHANNEL *$TEXT" > "$WEECHAT_PIPE" |
This file contains 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
const char * ca_pubkey = | |
{ | |
"-----BEGIN CERTIFICATE-----\n" | |
... | |
"-----END CERTIFICATE-----" | |
}; | |
void init(void) | |
{ | |
/* these both are called only once for the entire application */ |
OlderNewer