Skip to content

Instantly share code, notes, and snippets.

@orip
orip / Python-3.4.3-macos.patch
Created November 23, 2020 11:21
Patch for Python 3.4.x for macos, based on https://bugs.python.org/issue28676
diff --git a/Python/random.c b/Python/random.c
index 93d300d..396041d 100644
--- a/Python/random.c
+++ b/Python/random.c
@@ -3,6 +3,9 @@
#include <windows.h>
#else
#include <fcntl.h>
+#if defined(HAVE_GETRANDOM) || defined(HAVE_GETENTROPY)
+#include <sys/random.h>
@orip
orip / salsa20_obfuscator.c
Last active July 17, 2020 02:06
Using salsa20 to obfuscate strings, reference: https://stackoverflow.com/a/59929628/37020
// Relies on https://github.com/alexwebr/salsa20
// To compile and run: place it in a directory with salsa20.c and salsa20.h and run:
// % cc salsa20_obfuscator.c salsa20.c && ./a.out
// Then write strings in stdin. For example:
// % $ echo "Cancel" | ./a.out
// 'Cancel' -> [0x89, 0x88, 0x6a, 0xd1, 0x12, 0xc1]
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@orip
orip / symlinks_helper.d
Created December 5, 2019 11:12
DLang: does the file a symlink points to exist? ("exists" with dereference")
@orip
orip / wscript
Created September 11, 2019 12:28
waf rule for building golang with modules and vendoring
#!/usr/bin/env python
# encoding: utf-8
# Sample binary target based on golang 1.11+ using modules and vendoring.
#
# To use:
# - Update the go binary path if not in /usr/local/go/bin
# - Remove '-mod=vendor' if not using vendoring
bld.program(
@orip
orip / gist:adb3d6275e9f06976bfdee137ac1b50b
Created December 8, 2016 14:59
auto-closing vim plugins
https://github.com/cohama/lexima.vim
https://github.com/LucHermitte/lh-brackets
https://github.com/rstacruz/vim-closer
https://github.com/jiangmiao/auto-pairs
https://github.com/Raimondi/delimitMate
@orip
orip / rel.log.failures
Created November 19, 2015 08:10
PICT test failure w/clang++
EXP: 0 ACT: 2 bug020.txt /d:` /v
EXP: 0 ACT: 0.0078125 clus011.txt /o:5 /v
Seeding failure clus019.txt /v /r /e:.stdout
Seeding failure clus023.txt /d:space /v /r /e:.stdout
EXP: 0 ACT: 0.0078125 clus024.txt /d:space /v
EXP: 0 ACT: 0.0078125 clus024.txt /O:3 /d:space /v
Seeding failure clus100.txt /o:2 /v /r /e:.stdout
Seeding failure clus100.txt /o:3 /v /r /e:.stdout
Seeding failure clus101.txt /o:2 /v /r /e:.stdout
EXP: 0 ACT: 0.0078125 clus102.txt /o:1 /v
CXX=clang++
# suppress all warnings :-(
CXXFLAGS=-std=c++11 -stdlib=libc++ -Iapi -w
TARGET=pict
all:
$(CXX) $(CXXFLAGS) api/*cpp cli/*cpp -o $(TARGET)
test:
cd test; perl test.pl ../$(TARGET) rel.log

Keybase proof

I hereby claim:

  • I am orip on github.
  • I am orip (https://keybase.io/orip) on keybase.
  • I have a public key whose fingerprint is 9CA5 31A3 696E BD84 88BC 5BED AC4C 56E0 A3A1 8161

To claim this, I am signing this object:

import com.google.common.io.CharStreams;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/**
* Zero error checking or recovery. Apologies.
*
* Requires the READ_LOGS permission.
@orip
orip / AndroidPrivateFileGuavaAdapter.java
Last active August 29, 2015 14:03
Adapt between Android's Context.openFile{Input,Output} and its mode support, and Guava's sinks and sources.
// Available under the MIT license, http://opensource.org/licenses/MIT
/**
* Adapt between Context's file input/output streams and Guava's sinks and sources.
*
* This supports file modes.
*
* Usage:
* ByteSink sink =
* new AndroidPrivateFileGuavaAdapter(
* "foo", Context.MODE_PRIVATE, context).asByteSink();