Skip to content

Instantly share code, notes, and snippets.

@mewmew
mewmew / use-example.go
Last active December 24, 2019 00:35
Example of use-tracking API with modification of value.
// nopTrunc propagates From values of truncation instructions that have no
// effect on type (where From and To type are the same).
//
// Example:
//
// before:
// %10 = xor i32 %src2, %src1
// %11 = trunc i32 %10 to i32
// %12 = xor i32 %sum, %11
//
@mewmew
mewmew / subject.c
Created July 17, 2019 17:03 — forked from ceeac/subject.c
Boomerang v0.5.0 output for dmi/cfg test file
int main(int argc, char *argv[]);
void basic_1_if(__size32 param1);
void basic_2_if_else(__size32 param1);
void basic_3_if_elseif(int param1);
void basic_4_if_elseif_else(__size32 param1);
void basic_5_head_controlled_loop(__size32 param1);
void basic_6_tail_controlled_loop(__size32 param1);
void basic_7_for_loop();
void basic_8_forever_loop(__size32 param1);
void basic_9_dead_block();
@mewmew
mewmew / natural_sort.go
Created June 30, 2019 18:00 — forked from philippbayer/natural_sort.go
A perverted kind of natural sort in golang
package main
import (
"fmt"
"log"
"sort"
"strconv"
"strings"
"unicode"
)
@mewmew
mewmew / llvm-7.0_8.0.patch
Created April 1, 2019 07:08
Diff between LLVM 7.0 and 8.0 of the lib/AsmParser directory.
diff -r -u llvm-7.0.0.src/lib/AsmParser/LLLexer.cpp llvm-8.0.0.src/lib/AsmParser/LLLexer.cpp
--- llvm-7.0.0.src/lib/AsmParser/LLLexer.cpp 2018-07-12 11:03:53.000000000 +0900
+++ llvm-8.0.0.src/lib/AsmParser/LLLexer.cpp 2018-11-29 06:14:32.000000000 +0900
@@ -592,6 +592,7 @@
KEYWORD(arm_apcscc);
KEYWORD(arm_aapcscc);
KEYWORD(arm_aapcs_vfpcc);
+ KEYWORD(aarch64_vector_pcs);
KEYWORD(msp430_intrcc);
KEYWORD(avr_intrcc);
@mewmew
mewmew / ll.bnf
Created February 27, 2019 01:41
Gocc grammar for LLVM IR.
// Based on https://github.com/llir/grammar/blob/6cb09c87c6e434310b41d3c5b2b3d59c94f986c4/ll.bnf
// ### [ Lexical part ] ########################################################
_ascii_letter_upper
: 'A' - 'Z'
;
_ascii_letter_lower
: 'a' - 'z'
--- py_sort.txt 2018-12-31 03:00:59.745223854 +0100
+++ ll_sort.txt 2018-12-31 03:00:50.435164462 +0100
@@ -3,15 +3,22 @@
add
addrspace
addrspacecast
+afn
alias
+aliasee
align
#include <iostream>
using std::cout;
using std::endl;
// Typedef for the function pointer
typedef void (*_PVFV)(void);
// Our various functions/classes that are going to log the application startup/exit
struct TestClass
{
@mewmew
mewmew / gist:039e36dc8fd7b1d924aed7c9ef764813
Created December 20, 2018 19:17 — forked from debasishg/gist:8172796
A collection of links for streaming algorithms and data structures
  1. General Background and Overview
diff --git a/asm/global.go b/asm/global.go
index 5a1f04c..fc73db6 100644
--- a/asm/global.go
+++ b/asm/global.go
@@ -2,6 +2,7 @@ package asm
import (
"fmt"
+ "sync"
@mewmew
mewmew / git-extract-file.markdown
Created November 2, 2018 14:45 — forked from ssp/git-extract-file.markdown
Extract a single file from a git repository

How to extract a single file with its history from a git repository

These steps show two less common interactions with git to extract a single file which is inside a subfolder from a git repository. These steps essentially reduce the repository to just the desired files and should performed on a copy of the original repository (1.).

First the repository is reduced to just the subfolder containing the files in question using git filter-branch --subdirectory-filter (2.) which is a useful step by itself if just a subfolder needs to be extracted. This step moves the desired files to the top level of the repository.

Finally all remaining files are listed using git ls, the files to keep are removed from that using grep -v and the resulting list is passed to git rm which is invoked by git filter-branch --index-filter (3.). A bit convoluted but it does the trick.

1. copy the repository to extract the file from and go to the desired branch