Skip to content

Instantly share code, notes, and snippets.

View ysangkok's full-sized avatar

Janus Troelsen ysangkok

View GitHub Profile
import operator
import functools
import itertools
import os
import json
import struct
#import math
import bitarray
; basE91 encoder for DOS
;
; Copyright (c) 2005-2006 Joachim Henke
; All rights reserved.
;
; Redistribution and use in source and binary forms, with or without
; modification, are permitted provided that the following conditions are met:
;
; - Redistributions of source code must retain the above copyright notice,
; this list of conditions and the following disclaimer.
/*
* basE91 encoding/decoding routines
*
* Copyright (c) 2000-2006 Joachim Henke
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
#N canvas 571 147 693 605 10;
#X obj -28 347 shell;
#X obj 59 -59 adc~;
#X obj 59 2 - 100;
#X floatatom 80 39 5 0 0 0 - - -;
#X obj 167 98 vu 15 120 empty empty -1 -8 0 10 -66577 -1 1 0;
#X floatatom -29 233 5 0 0 0 - - -;
#X obj -29 254 select 1;
#X obj -28 453 shell;
#X obj -4 157 &&;
@ysangkok
ysangkok / smallqm.js
Created June 4, 2013 16:06
Quine-McCluskey in JavaScript
"use strict";
// from http://stackoverflow.com/a/11454049/309483
var combine = function (m, n) {
var a = m.length, c = '', count = 0, i;
for (i = 0; i < a; i++) {
if (m[i] === n[i]) {
c += m[i];
} else if (m[i] !== n[i]) {
#!/bin/bash
FILEID=$(dd status=none if=/dev/urandom bs=1k count=1 | curl -s --data-urlencode cryptofile@- -d metadata=metadata -d deletepassword=passwd "https://hushfile.it/api/upload" | python3 -c "import sys; import json; print(json.loads(sys.stdin.read())['fileid'])")
curl -s "https://hushfile.it/api/file?fileid=$FILEID" | wc -c
@ysangkok
ysangkok / gist:8411890
Last active January 3, 2016 04:49
hushfile encrypted upload
#!/usr/bin/env bash
cat INPUTFILE | \
openssl enc -aes-256-cbc -pass pass:BOSS123 | \
base64 | \
tr -d '\n' | \
curl --data-urlencode cryptofile@- --data-urlencode metadata=$(\
echo '{"filename":"lol","mimetype":"text/lol","filesize":"very big","deletepassword":"ITSWRONG"}' | \
openssl enc -aes-256-cbc -pass pass:BOSS123 | \
base64 | \
tr -d '\n'\

Keybase proof

I hereby claim:

  • I am ysangkok on github.
  • I am janus (https://keybase.io/janus) on keybase.
  • I have a public key whose fingerprint is BDC6 2E7F A5C0 D19C 37EA EB4E E5BA B359 B6FC 16C4

To claim this, I am signing this object:

@ysangkok
ysangkok / gist:5f45239c612e0056b9b4
Last active August 29, 2015 14:13
build weechat-1.1 and dependencies
wget -O - "ftp://ftp.gnupg.org/gcrypt/libgpg-error/libgpg-error-1.17.tar.bz2" | tar jx
cd libgpg-error-1.17
./configure --prefix=$HOME/libgpg-error-build
make -j4
make install
cd ..
wget -O - "ftp://ftp.gnupg.org/gcrypt/libgcrypt/libgcrypt-1.6.2.tar.bz2" | tar jx
cd libgcrypt-1.6.2
./configure --prefix=$HOME/libgcrypt-build PATH=$HOME/libgpg-error-build/bin:$PATH
@ysangkok
ysangkok / gist:deb293e0530fdc7075ac
Last active November 6, 2015 18:26
building irssi and dependencies without root
INST=/home/janus/or1k-inst
RUNPREFIX=/home/user
mkdir $INST
CC=/opt/cross/or1k-linux-musl/bin/or1k-linux-musl-gcc
wget -O - ftp://sourceware.org/pub/libffi/libffi-3.2.1.tar.gz | tar zx
cd libffi-3.2.1
./configure --prefix=$RUNPREFIX/libffi-build #--host=or1k-linux-musl CC=$CC
make -j2
make install DESTDIR=$INST