Skip to content

Instantly share code, notes, and snippets.

View rLinks234's full-sized avatar
🎯
Focusing

Daniel Wright rLinks234

🎯
Focusing
  • Motional
  • Pittsburgh, PA, USA
View GitHub Profile
@rLinks234
rLinks234 / export_issues.js
Last active August 29, 2018 17:58
GitHub helper scripts
/**
* Adopted from: https://gist.github.com/MoOx/93c2853fee760f42d97f
* This will additionally get the description of the issue, if it exists. Otherwise, it will be an empty string
*/
// Run this from the developer console in Chrome/Firefox, on your repository's issues page
// https://github.com/${repoOwner}/${repoName}/labels
var labels = [];
[].slice.call(document.querySelectorAll(".label-link"))
@rLinks234
rLinks234 / README
Last active August 11, 2018 20:09
glibc 2.20 patch to fix some aarch64 relocation issues
Adapted from https://sourceware.org/git/?p=glibc.git;a=blobdiff;f=sysdeps/aarch64/dl-machine.h;h=e7656129f50cce3ecf375c31b4d26d55d4330290;hp=b1245476dc26a8fc5b620142d07bfc9b3da9e955;hb=a68ba2f3cd3cbe32c1f31e13c20ed13487727b32;hpb=346729f66b905344e4ce24045489d189e5b4a9b8
Note that the patch is not identical to above - we are diffing that change against the vanilla glibc 2.20 from gnu's FTP site
@rLinks234
rLinks234 / float_to_bin.py
Last active July 5, 2018 15:43
View binary representation of floats (Python 3)
loc = list()
# TODO: Add your floats to `loc`
loc.append(0.0)
loc.append(1e-308)
loc.append(1e-305)
loc.append(1e-300)
loc.append(1e-275)
loc.append(1e-250)
loc.append(1e-200)
@rLinks234
rLinks234 / prep_nouveau_blacklist
Created December 15, 2017 15:46
Blacklist Nouveau on Fedora 25-27
#!/bin/bash
# Adopted from https://www.if-not-true-then-false.com/2015/fedora-nvidia-guide/#before-installation
if [ `whoami` != "root" ]; then
echo you must run this as root
exit 1
fi
touch /etc/modprobe.d/blacklist.conf
@rLinks234
rLinks234 / test1.cpp
Created October 31, 2017 22:31
x86-64 get ISA extensions (SSE[1-4.x], AVX[1-2])
// g++ -m64 -lstdc++ test1.cpp -o test1
#include <stdint.h>
#include <iostream>
struct x86_64__extension_support {
bool has_sse;
bool has_sse2;
bool has_sse3;
bool has_ssse3;
@rLinks234
rLinks234 / perf_examples.sh
Last active November 7, 2017 22:13
Perf examples
# This covers most relevant cache loading/storing and pipeline events
perf stat -e \
L1-dcache-load-misses,L1-dcache-loads,L1-dcache-stores,L1-icache-load-misses,\
LLC-load-misses,LLC-loads,LLC-store-misses,LLC-stores,\
branch-loads,branch-load-misses,alignment-faults $COMMAND
# Adds upon above but with backend info (used on Haswell-E 5820k)
perf stat -e \
L1-dcache-load-misses,L1-dcache-loads,L1-dcache-stores,L1-icache-load-misses,\
LLC-load-misses,LLC-loads,LLC-store-misses,LLC-stores,\
@rLinks234
rLinks234 / setup_fedora_env.sh
Last active August 1, 2018 17:53
Script to setup my preferred Fedora environment
#!/bin/bash
# Set this to whatever you need.
# Don't feel like dealing with param args or parsing `users` & `groups` ...
USER=daniel
GROUP=daniel
if [ ! $(whoami) == "root" ]; then
echo "You must run this as root."
exit 1
@rLinks234
rLinks234 / print_bits.cpp
Created March 16, 2017 15:13
Print binary representation of primitive data types in a printf manner, which is largely missing in C++/C libraries
#include <stdint.h>
#define BIT_NUM0 0x1
#define BIT_NUM1 0x2
#define BIT_NUM2 0x4
#define BIT_NUM3 0x8
#define BIT_NUM4 0x10
#define BIT_NUM5 0x20
#define BIT_NUM6 0x40
#define BIT_NUM7 0x80
@rLinks234
rLinks234 / AllocUtils.java
Created February 6, 2017 13:54
Android Pinned Array Hack
import java.lang.reflect.Method;
/// You should probably add the following property (under the "application" tag) to your AndroidManifest.xml, just for large heap support
/// android:largeHeap="true"
public final class AllocUtils {
interface AllocPinnedArray {
Object allocPinnedArray(Class<?> pClass, int pCount);
}
@rLinks234
rLinks234 / JNIExample1.java
Last active May 22, 2022 02:34
Simple Java VM in C++ application Prototype
package com.ajdt.test;
import javax.swing.JOptionPane;
/// To properly compile and use this with the Java in C++ prototype,
/// put this file in the subfolder "com/ajdt/test"
///
/// To compile, use the following command:
/// javac -classpath <your_local_working_directory> <your_local_working_directory>/com/ajdt/test/JNIExample1.java
///