Skip to content

Instantly share code, notes, and snippets.

@thomasdullien
thomasdullien / .block
Last active April 15, 2016 14:48
A first go at writing a D3.js-based heap visualizer. It is folly to use a browser for this (instead of a GPU and a proper canvas), but ok...
license apache-2.0
height 1000
width 1600
@thomasdullien
thomasdullien / load_pdb.py
Last active May 7, 2017 02:41 — forked from joshwatson/load_pdb.py
PDB Loading Plugin for binaryninja
import os
import threading
import pdbparse
from pdbparse.pe import Sections
from pdbparse.omap import Omap
import binaryninja as bn
def load_pdb_thread(bv):
@thomasdullien
thomasdullien / inception_annoy.py
Created June 11, 2017 21:06
Inception for feature extraction, ANNoy for nearest-neighbor search
"""
Simple, hacked-up image similarity search using Tensorflow + the inception
CNN as feature extractor and ANNoy for nearest neighbor search.
Requires Tensorflow and ANNoy.
Based on gist code under
https://gist.github.com/david90/e98e1c41a0ebc580e5a9ce25ff6a972d
"""
from annoy import AnnoyIndex
@thomasdullien
thomasdullien / savings_chart.html
Created April 29, 2019 14:02
attempting to visualize cost savings
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Minimal D3 Example</title>
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<style>
.service_bar_pre {
fill: steelblue;
stroke-width: 3;
@thomasdullien
thomasdullien / index.html
Last active April 29, 2019 16:17
D3 Diagram to illustrate savings.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Minimal D3 Example</title>
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<style>
:root {
--savings-color: #A9C3D0F0;
@thomasdullien
thomasdullien / mirror_upstream_repo.sh
Created June 19, 2020 15:33
A small shell script to mirror upstream package repositories
DIRECTORIES="main contrib non-free restricted universe multiverse"
UBUNTU="http://mirror.hetzner.de/ubuntu/packages/pool/ http://ddebs.ubuntu.com/pool/";
DEBIAN="http://mirror.hetzner.de/debian/packages/pool/ http://debug.mirrors.debian.org/debian-debug/pool/"
if [[ $# -eq 0 ]]
then
echo "Choose 'all', 'debian', or 'ubuntu' as first argument."
exit 1
fi
DIRECTORIES="main contrib non-free restricted universe multiverse"
UBUNTU="http://mirror.hetzner.de/ubuntu/packages/pool/ http://ddebs.ubuntu.com/pool/";
DEBIAN="http://mirror.hetzner.de/debian/packages/pool/ http://debug.mirrors.debian.org/debian-debug/pool/"
UBUNTU_DSC="http://archive.ubuntu.com/ubuntu/pool/"
DEBIAN_DSC="http://ftp.debian.org/debian/pool/"
if [[ $# -eq 0 ]]
then
echo "Choose 'all', 'debian', or 'ubuntu' as first argument."
exit 1
@thomasdullien
thomasdullien / fs.go
Created August 25, 2021 14:35
GetDirUsage from fs.go doing recursive directory walks
func GetDirUsage(dir string) (UsageInfo, error) {
var usage UsageInfo
if dir == "" {
return usage, fmt.Errorf("invalid directory")
}
rootInfo, err := os.Stat(dir)
if err != nil {
return usage, fmt.Errorf("could not stat %q to get inode usage: %v", dir, err)
@thomasdullien
thomasdullien / Dockerfile
Created August 25, 2021 14:55
Source code for a container that creates a large directory tree
FROM ubuntu:bionic
RUN chmod 777 /tmp
RUN apt-get update && apt-get -y upgrade
RUN apt-get install -y git wget cmake sudo gcc-7 g++-7 python3-pip zlib1g-dev g++
RUN mkdir /code
COPY ./main.cpp /code
RUN g++ /code/main.cpp -o /code/a.out
RUN chmod +x /code/a.out
@thomasdullien
thomasdullien / relu_viz.py
Created June 27, 2024 14:09
a NN visualization experiment
from PIL import Image, ImageOps, ImageDraw
import numpy as np
import pandas as pd
import os, sys
#import ace_tools as tools
# Function to load an image from a file
def load_image(file_path):
return Image.open(file_path)