Skip to content

Instantly share code, notes, and snippets.

View alexeiz's full-sized avatar

alexeiz alexeiz

View GitHub Profile
@alexeiz
alexeiz / docker-toolbox.md
Last active March 25, 2016 03:50
Add an arbitrary mount point to Docker Toolbox containers
  • Add a "Shared Folder" to the default docker VirtualBox virtual machine. There is already a shared folder C:\Users. Add, for example, share host C:\Temp directory as c/Temp.
  • Add the following code to C:\Program Files\Docker Toolbox\start.sh:
init_mounts() {
    ${DOCKER_MACHINE} ssh ${VM} sudo 'mkdir /c/Temp'
    ${DOCKER_MACHINE} ssh ${VM} sudo 'chown docker:staff /c/Temp'
    ${DOCKER_MACHINE} ssh ${VM} sudo 'mount -t vboxsf c/Temp /c/Temp'
}
#include <iostream>
#include <thread>
#include <mutex>
#include <condition_variable>
#include <chrono>
#include <boost/thread/barrier.hpp>
using namespace std;
using clock_type = chrono::system_clock;
@alexeiz
alexeiz / fonts.conf
Created July 14, 2016 21:28
Font substitutions
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<!-- ~/.config/fontconfig/fonts.conf -->
<fontconfig>
<match target="pattern">
<test qual="any" name="family"><string>Arial</string></test>
<edit name="family" mode="assign" binding="same"><string>Noto Sans</string></edit>
</match>
</fontconfig>
@alexeiz
alexeiz / stones.py
Last active August 22, 2016 21:08
stones game
#!/usr/bin/env python3
from pprint import pprint
from copy import deepcopy
import functools
import sys
import re
def hash_game(game):
return game.get_hash()
@alexeiz
alexeiz / pip-upgrade.sh
Created March 7, 2017 16:47
Upgrade outdated pip modules
#!/bin/sh
pip list --outdated --format=legacy | \
sed -E 's/^(\S+)(.*)$/\1/' | \
xargs pip install -U
@alexeiz
alexeiz / add_file_content.log
Last active June 9, 2017 05:43
Add a file content to a compiled binary to read at runtime.
$ cat myasmfile.S
.global MyAwesomeBinary, MyAwesomeBinaryEnd
.data
.align 8
MyAwesomeBinary:
.incbin "file.txt"
MyAwesomeBinaryEnd:
.zero 1
@alexeiz
alexeiz / proc-affinity.sh
Created July 25, 2017 17:21
List affinities of process threads
#!/usr/bin/env bash
set -euo pipefail
[[ $# == 0 || $1 == '-h' ]] && {
bn=$(basename $0)
echo "$bn: list affinities of process threads"
echo "usage: $bn [pid|-p name]"
exit
}
@alexeiz
alexeiz / avahi-browse.diff
Created July 31, 2017 05:38
Avahi-browse continue on error
diff --git a/avahi-utils/avahi-browse.c b/avahi-utils/avahi-browse.c
index 4101895..ab56eaa 100644
--- a/avahi-utils/avahi-browse.c
+++ b/avahi-utils/avahi-browse.c
@@ -375,8 +375,12 @@ static void browse_service_type(Config *c, const char *stype, const char *domain
service_browser_callback,
c))) {
- fprintf(stderr, _("avahi_service_browser_new() failed: %s\n"), avahi_strerror(avahi_client_errno(client)));
- avahi_simple_poll_quit(simple_poll);
root@ubuntu:~# ./a.out
Reading 40 bytes:
Reading at malicious_x = 0xffffffffffdfeba8... Unclear: 0x54='T' score=980 (second best: 0x02 score=706)
Reading at malicious_x = 0xffffffffffdfeba9... Unclear: 0x68='h' score=929 (second best: 0x02 score=709)
Reading at malicious_x = 0xffffffffffdfebaa... Unclear: 0x65='e' score=973 (second best: 0x02 score=786)
Reading at malicious_x = 0xffffffffffdfebab... Unclear: 0x20=' ' score=928 (second best: 0x02 score=784)
Reading at malicious_x = 0xffffffffffdfebac... Unclear: 0x4D='M' score=746 (second best: 0x02 score=730)
Reading at malicious_x = 0xffffffffffdfebad... Unclear: 0x61='a' score=978 (second best: 0x02 score=749)
Reading at malicious_x = 0xffffffffffdfebae... Success: 0x67='g' score=39 (second best: 0x02 score=17)
Reading at malicious_x = 0xffffffffffdfebaf... Unclear: 0x69='i' score=972 (second best: 0x02 score=748)
@alexeiz
alexeiz / spectre.c
Created January 5, 2018 06:52 — forked from ErikAugust/spectre.c
Spectre example code
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#ifdef _MSC_VER
#include <intrin.h> /* for rdtscp and clflush */
#pragma optimize("gt",on)
#else
#include <x86intrin.h> /* for rdtscp and clflush */
#endif