Skip to content

Instantly share code, notes, and snippets.

@ackdav
ackdav / aflclangubuntu.patch
Created January 25, 2021 09:43
Fix to compile llvm_mode under ubuntu 18.04
--- Makefile 2021-01-17 11:40:03.780036900 +0000
+++ MakefileNew 2021-01-17 11:40:25.664199205 +0000
@@ -36,7 +36,8 @@
CXXFLAGS += -Wall -D_FORTIFY_SOURCE=2 -g -Wno-pointer-sign \
-DVERSION=\"$(VERSION)\" -Wno-variadic-macros
-CLANG_CFL = `$(LLVM_CONFIG) --cxxflags` -fno-rtti -fpic $(CXXFLAGS)
+#CLANG_CFL = `$(LLVM_CONFIG) --cxxflags` -fno-rtti -fpic $(CXXFLAGS)
+CLANG_CFL = `$(LLVM_CONFIG) --cxxflags` -Wl,-znodelete -fno-rtti -fpic $(CXXFLAGS)
CLANG_LFL = `$(LLVM_CONFIG) --ldflags` $(LDFLAGS)
@ackdav
ackdav / README.txt
Created October 26, 2020 05:54 — forked from moyix/README.txt
Recover edge information from afl-showmap
If you have a list of edge hashes produced by AFL (e.g. from something like this):
./afl-showmap -o foo.edges -t 500 -q -e -- ./program arg1
Re-run the program using gdb to trace the sequence of block IDs:
./collect_coverage.sh trace.txt ./program arg1
Print edges in the trace:
@ackdav
ackdav / Git Subtree basics.md
Created August 7, 2020 11:33 — forked from SKempin/Git Subtree basics.md
Git Subtree basics

Git Subtree Basics

If you hate git submodule, then you may want to give git subtree a try.

Background

When you want to use a subtree, you add the subtree to an existing repository where the subtree is a reference to another repository url and branch/tag. This add command adds all the code and files into the main repository locally; it's not just a reference to a remote repo.

When you stage and commit files for the main repo, it will add all of the remote files in the same operation. The subtree checkout will pull all the files in one pass, so there is no need to try and connect to another repo to get the portion of subtree files, because they were already included in the main repo.

Adding a subtree

Let's say you already have a git repository with at least one commit. You can add another repository into this respository like this:

@ackdav
ackdav / configinstall
Last active May 24, 2020 11:40
Install my config (private)
alias config='/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME'
git clone --bare [email protected]:derdav3/cfg.git $HOME/.cfg
function config {
/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME $@
}
mkdir -p .config-backup
config checkout
if [ $? = 0 ]; then
echo "Checked out config.";
@ackdav
ackdav / gist:c122df5d097504886fc1dd6f644f1892
Created August 30, 2019 11:33
Upgrade Ubuntu 19 sound via pulse_audio config
From here: https://medium.com/@gamunu/enable-high-quality-audio-on-linux-6f16f3fe7e1f
config in vim ~/.config/pulse/daemon.conf
default-sample-format = float32le
default-sample-rate = 48000
alternate-sample-rate = 44100
default-sample-channels = 2
default-channel-map = front-left,front-right
default-fragments = 2
Verifying my Blockstack ID is secured with the address 1TDk1J7t7F2ardV5LRoSrMGEVHDJ1hnc8 https://explorer.blockstack.org/address/1TDk1J7t7F2ardV5LRoSrMGEVHDJ1hnc8
@ackdav
ackdav / line_count.py
Created April 14, 2017 10:37
Fast way to get line count in python
def wccount(filename):
out = subprocess.Popen(['wc', '-l', filename],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT
).communicate()[0]
return int(out.lstrip().split()[0])
@ackdav
ackdav / NN-for-loop.py
Last active November 23, 2022 09:16
For loop for creating neural net layers in tensorflow
'''
I've found this little setup (https://pythonprogramming.net/community/262/TensorFlow%20For%20loop%20to%20set%20weights%20and%20biases/)
to create layers in a NN with a for loop. Unfortunately it doesn't really work - so here is a corrected version:
keep in mind, layer_config takes the form: [n_input, 200, 200, 200, 200, n_classes]
'''
def multilayer_perceptron(x, layer_config, name="neuralnet"):
'''
code from: https://pythonprogramming.net/community/262/TensorFlow%20For%20loop%20to%20set%20weights%20and%20biases/
'''
@ackdav
ackdav / deep-net.py
Created November 30, 2016 09:53
Source Code to "Sentdex Deep Learning with Neural Networks and Tensorflow" part 4
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("/tmp/data/", one_hot=True)
n_nodes_hl1 = 500
n_nodes_hl2 = 500
n_nodes_hl3 = 500
@ackdav
ackdav / AutoExpandingTextInput.js
Created September 17, 2016 19:30
AutoExpandingTextInput for React-Native
import React, {Component} from 'react'
import {TextInput} from 'react-native'
export default class AutoExpandingTextInput extends Component {
state: any;
constructor(props) {
super(props);
this.state = {text: '',tags:[], height: 0};
}
render() {