Skip to content

Instantly share code, notes, and snippets.

View Quiark's full-sized avatar

Roman Plášil Quiark

View GitHub Profile
@Quiark
Quiark / sandbox.h
Created January 2, 2020 07:00
restricted version of sbtool that is compilable
// courtesy of clang
// https://github.com/applesrc/clang/blob/bb8f644/src/projects/compiler-rt/lib/sanitizer_common/sanitizer_mac_spi.cc
enum sandbox_filter_type {
SANDBOX_FILTER_NONE,
SANDBOX_FILTER_PATH,
SANDBOX_FILTER_GLOBAL_NAME,
SANDBOX_FILTER_LOCAL_NAME,
SANDBOX_FILTER_APPLEEVENT_DESTINATION,
mocha.setup({
ui: 'bdd',
timeout: 1000000
});
describe('key-recovery', function() {
describe('messaging', function() {
var allSessions, allMessengers, del;
beforeEach(function() {
private static final String CR_ALG_AES = "AES/CBC/PKCS5Padding";
private static final String CR_ALG_HMAC = "HmacSHA256";
private static final int CR_SALT_LENGTH = 16;
private CryptoHeader prepareHeader() {
CryptoHeader header = new CryptoHeader();
header.iv = new byte[16];
rnd.nextBytes(header.iv);
header.salt = new byte[CR_SALT_LENGTH];
rnd.nextBytes(header.salt);
@Quiark
Quiark / kdf.java
Last active February 28, 2016 07:55
Java Crypto Basics: generating key
import org.bouncycastle.crypto.PBEParametersGenerator;
import org.bouncycastle.crypto.digests.SHA256Digest;
import org.bouncycastle.crypto.generators.PKCS5S2ParametersGenerator;
import org.bouncycastle.crypto.params.KeyParameter;
private final int CR_ITERATIONS = 128 * 1000;
public byte[] kdfPassword(String pwd, byte[] salt, int outLength) {
PKCS5S2ParametersGenerator gen = new PKCS5S2ParametersGenerator(new SHA256Digest());
gen.init(PBEParametersGenerator.PKCS5PasswordToUTF8Bytes(pwd.toCharArray()), salt, CR_ITERATIONS);
@Quiark
Quiark / compile.sh
Last active January 19, 2016 04:17
Emscripten exception bug
#!/bin/sh
FLAGS='-Wall -pedantic -std=c++11 -m32 -O0'
echo Compiling Emscripten...
mkdir -p emcc
/usr/local/opt/emscripten/libexec/em++ -o emcc/run.o $FLAGS -c -s DISABLE_EXCEPTION_CATCHING=0 -D_EXPORTING -D_REENTRANT -Isrc -Ithirdparty run.cpp
/usr/local/opt/emscripten/libexec/em++ -o emcc/tests_run.html $FLAGS -s DISABLE_EXCEPTION_CATCHING=0 emcc/run.o
echo Compiling native...
@Quiark
Quiark / gist:4016495
Created November 5, 2012 10:23
upload.html
$("#droparea").bind("drop", function(e){
files = e.dataTransfer.files;
e.preventDefault();
$.each(files,function(index,file){
var form = new FormData();
form.append("myFile", file);
$.ajax({
type: "POST",
@Quiark
Quiark / tresky.clj
Created February 22, 2011 23:50
Ukázka kódu tresky plesky
(defn plesk
([request item] (plesk request item {}))
([request item kwargs]
(let [rnd-box (fn [word]
(let [rnd-gen (new Random (.hashCode word))
gen-color (fn [] (+ 155 (.nextInt rnd-gen 100)))]
[:span {:style
(str "padding: "
(.nextFloat rnd-gen) "ex "
(.nextFloat rnd-gen) "ex "
@Quiark
Quiark / format.reg
Created February 22, 2011 16:54
Formátování C# v espace
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0\CSharp\Options\Formatting]
"NewLines_Braces_AnonymousMethod"=dword:00000000
"NewLines_Braces_ControlFlow"=dword:00000000
"NewLines_Braces_AnonymousTypeInitializer"=dword:00000000
"NewLines_Braces_ObjectInitializer"=dword:00000000
"NewLines_Braces_LambdaExpressionBody"=dword:00000000
"NewLines_Keywords_Else"=dword:00000000
"NewLines_Keywords_Catch"=dword:00000000
VectorView = {
'path': r'src\Core\VectorView',
'proj': r'VectorView',
'new_name': 'MoNET_VectorView',
'cpp_include': [r'..\..\External\libpng-1.2.23', r'..\..\External\zlib'],
'link_include': [r'..\..\External\libpng-1.2.23\bin\visualc9'],
'libs': ['libpng.lib', 'zlib.lib'],
'exclude': ['hipng.cpp']}
ctags --langmap=JavaScript:.js "--regex-JavaScript=/([A-Za-z0-9._$]+)[ \t]*[:=][ \t]*\{/\1/,object/" "--regex-JavaScript=/[A-Za-z0-9_$()]*.*prototype.([A-Za-z0-9_$()]+)[ \t]*[:=][ \t]*function[ \t]*\(/\1/,function/" "--regex-JavaScript=/function[ \t]+([A-Za-z0-9._$]+)[ \t]*\(([^)])\)/\1/,function/" "--regex-JavaScript=/([A-Za-z0-9._$]+)[ \t]*[:=][ \t]*\[/\1/,array/" -R *.js controls/*.js