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
type printer struct { | |
sync.Mutex | |
queue chan api.ContainerEvent | |
consumer api.LogConsumer | |
stopped bool | |
} | |
// newLogPrinter builds a LogPrinter passing containers logs to LogConsumer | |
func newLogPrinter(consumer api.LogConsumer) logPrinter { | |
queue := make(chan api.ContainerEvent) |
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
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use Digest::SHA qw(sha256_hex sha256); | |
use MIME::Base64 qw(encode_base64 decode_base64url); | |
sub pack_issuer { pack('n2A*', 0x0002, length $_[0], $_[0]) } | |
sub pack_origin { pack('xnA*', length $_[0], $_[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
/* | |
> gcc48 main.c -o test 01/27 18:45 | |
> ./test 01/27 18:46 | |
hello world! | |
> cat main.c | |
*/ | |
/* FreeBSD, GCC 4.8 */ | |
const char main[] = { | |
0xb8,0x04,0x00,0x00,0x00, // mov $0x4,%eax ; syscall write | |
0xbf,0x01,0x00,0x00,0x00, // mov $0x1,%edi ; stdout, 1st arg |
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
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE TypeOperators #-} | |
module TuplePlus where | |
import GHC.Generics | |
class GTuplePlus f where | |
gplus :: f p -> f p -> f p |
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
package main | |
import ( | |
"fmt" | |
"runtime" | |
) | |
func main0() { | |
var a = []int{1, 2, 3, 4, 5} | |
for i := range a { |
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
using terms from application "Messages" | |
on message sent theMessage for theChat | |
end message sent | |
on message received theMessage from theBuddy for theChat | |
if name of theBuddy contains "_phone_#_" and theMessage = "lock" then | |
tell application "System Events" | |
start current screen saver | |
end tell |
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
--- pam_script/pam_script.c 2014-06-27 03:39:02.000000000 +0800 | |
+++ pam_script/pam_script.c 2015-01-31 10:15:21.000000000 +0800 | |
@@ -24,6 +24,9 @@ | |
#include <sys/wait.h> /* wait */ | |
#include <unistd.h> /* stat, fork, execve, **environ */ | |
#include <stdlib.h> /* calloc, setenv, putenv */ | |
+#include <signal.h> /* signal, SIGCHLD, SIG_DFL, SIG_ERR */ | |
+ | |
+typedef void (*sighandler_t)(int); | |
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 Foreign.Java | |
main :: IO () | |
main = do | |
initJava ["-Djava.class.path=/home/horus/test"] | |
runJava $ do | |
Just testClass <- getClass "Test" | |
Just systemClass <- getClass "java.lang.System" | |
Just printStreamClass <- getClass "java.io.PrintStream" | |
Just outField <- getStaticField systemClass "out" (object "java.io.PrintStream") |
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 java.util.function.*; | |
import java.util.stream.*; | |
public class Test { | |
public static void main(String[] args) { | |
Supplier<Integer> times = () -> 3; | |
Function<Integer, String> dotimes = x -> { | |
String val; | |
switch(x) { | |
case 1: val = "once"; |
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
module Lab5 where | |
import Control.Monad | |
data Concurrent a = Concurrent ((a -> Action) -> Action) | |
data Action | |
= Atom (IO Action) | |
| Fork Action Action | |
| Stop |
NewerOlder