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
open Cryptokit | |
let ($) f x = f x | |
let (%) f g = fun x -> f (g x) | |
let to_hex = transform_string (Hexa.encode()) | |
let of_hex = transform_string (Hexa.decode()) | |
let hmac_sha512 key str = | |
let blocksize = 128 in |
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
open ZMQ | |
open ZMQ.Socket | |
let context = init () | |
let _ = print_endline "Connecting to hello world server..." | |
let requester = Socket.create context req | |
let _ = connect requester "tcp://localhost:5555" | |
let _ = | |
for i = 1 to 10 do |
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 <string> | |
#include <iostream> | |
#include <tesseract/baseapi.h> | |
#include <leptonica/allheaders.h> | |
extern "C" { | |
#include <caml/mlvalues.h> | |
#include <caml/memory.h> | |
#include <caml/alloc.h> | |
#include <caml/fail.h> |
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
(* ocamlfind ocamlopt -o scan -package unix,pcre scan.ml -linkpkg | |
Якщо знайти адресу кількості трупів сектоїдів, то забити склад | |
ніштяками можна, наприклад, так: | |
let addr = $sectoids | |
and pid = <XCOM pid> | |
and ch = open_out "cmd.gdb" in | |
for i = 0 to 35 do | |
Printf.fprintf ch "set {int}(0x%X + 4*%d) = 99999\n" addr i |
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/local/bin/zsh | |
# Need flock | |
zmodload zsh/system | |
lfn=/tmp/.github | |
git=/usr/local/bin/git | |
prefix=/path/to/clones | |
secret=your_secret | |
user=mailnull |
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
open Printf | |
type t = A of string * float | B of int * float | |
let l = [A ("a1", 0.); B (1, 1.); A ("a2", 1.1); A ("a3",1.2); B (2,1.1)] | |
let f = fun l -> | |
List.fold_left | |
(fun (a,b) it -> | |
match it,a,b with |
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
(* ocamlfind ocamlopt -o exmpl -package curl -linkpkg exmpl.ml *) | |
open Printf | |
let _ = Curl.global_init Curl.CURLINIT_GLOBALALL | |
(* | |
************************************************************************* | |
** Aux. functions | |
************************************************************************* | |
*) |
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
let (>>) x f = f x ;; | |
let hash = hash_string (Hash.sha256()) ;; | |
let sign_of_message key msg = | |
msg >> hash >> | |
(pkcs1v1pad key) >> | |
(RSA.sign key) >> | |
strrev | |
;; |
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
let strrev s = | |
let len = String.length s in | |
for i = 0 to ((len/2) - 1) do | |
let t = s.[i] in | |
s.[i] <- s.[len - i - 1]; | |
s.[len - i - 1] <- t | |
done; | |
s | |
;; |
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
let pkcs1v2pad key msg = | |
let blen = key.RSA.size/8 | |
and mlen = String.length msg | |
and zero = char_of_int 0 | |
and rnd = Random.string Random.secure_rng in | |
let padlen = blen - mlen in | |
if padlen > 3 then begin | |
let res = rnd padlen in | |
res.[0] <- (char_of_int 0); | |
res.[1] <- (char_of_int 2); |