Skip to content

Instantly share code, notes, and snippets.

Andrew Dunham andrew-d

Block or report user

Report or block andrew-d

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@andrew-d
andrew-d / set-power-uuid.sh
Created May 27, 2019
Bash script to set INT3400 Thermal zone power profile
View set-power-uuid.sh
#!/bin/bash
set -eu
die() {
echo "$1" >&2
exit 1
}
@andrew-d
andrew-d / update-gvisor-deps.py
Created Dec 10, 2018
Very WIP script to update dependencies for gvisor in Nix
View update-gvisor-deps.py
#!/usr/bin/env python
from __future__ import print_function
import re
import sys
import json
import random
import shutil
import tempfile
@andrew-d
andrew-d / cpp-file-macro.patch
Created Oct 28, 2018
Testing patch for `cpp` in Nixpkgs that removes store paths from the __FILE__ macro
View cpp-file-macro.patch
diff --git i/libcpp/macro.c w/libcpp/macro.c
index c2515534504..ab593251def 100644
--- i/libcpp/macro.c
+++ w/libcpp/macro.c
@@ -288,8 +288,8 @@ _cpp_builtin_macro_text (cpp_reader *pfile, cpp_hashnode *node,
case BT_FILE:
case BT_BASE_FILE:
{
- unsigned int len;
- const char *name;
@andrew-d
andrew-d / int3400-more-uuids.patch
Created Sep 10, 2018
Thinkpad X1 Carbon thermal throttling patches for Linux
View int3400-more-uuids.patch
commit 0000000000000000000000000000000000000000
Author: Andrew Dunham <redacted>
Date: Mon Jan 01 00:00:00 2018 +0100
Apply https://patchwork.kernel.org/patch/8756801/
Original commit message:
Added AdaptivePerformance, EmergencyCallMode,
PassivePolicy2, PowerBoss, VirtualSensor
@andrew-d
andrew-d / nix2-arm-build.sh
Last active Apr 9, 2018
Helpful script to build a copy of Nix 2.0 for ARM (arm-linux-gnueabihf)
View nix2-arm-build.sh
#!/bin/bash
# USAGE: docker run -t -i --rm -v $PWD:/out ubuntu:16.04 /out/build.sh
set -eu
# Install
install_packages() {
apt-get update && apt-get upgrade -yy
@andrew-d
andrew-d / freeotp-redisplay.py
Created Sep 21, 2016
Read a FreeOTP tokens.xml file and display the entries as QR codes
View freeotp-redisplay.py
#!/usr/bin/env python
from __future__ import print_function
import base64
import ctypes
import json
import subprocess
import sys
import xml.etree.ElementTree as ET
View unicode.rb
class Unicode < Formula
desc "Display Unicode character properties"
homepage "https://github.com/garabik/unicode"
version "2.4"
url "https://github.com/garabik/unicode/archive/v#{version}.tar.gz"
sha256 "0e3dbf8ae9b136e1799d3ed59628d2908cd89cf4ee8f3a8277d5cffc6e12e8e4"
# Python 2 has somewhat brain-dead Unicode behavior
depends_on :python3
@andrew-d
andrew-d / gpgverify.py
Created Jul 7, 2016
Simple wrapper around `gpg --verify` with some pretty output
View gpgverify.py
#!/usr/bin/env python
from __future__ import print_function
import re
import sys
import subprocess
from datetime import datetime
@andrew-d
andrew-d / main.c
Last active Dec 5, 2017
Example of how to get current binary's path using Apple's Code Signing Services
View main.c
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
#include <Security/Security.h>
// Compile with:
// gcc -o ourpath -framework CoreFoundation -framework Security main.c
View alloc.c
#include <stdio.h>
#include <windows.h>
int main(void) {
int ctr = 0;
int i;
for( i = 0; ; i++ ) {
void* ret = VirtualAllocEx(
You can’t perform that action at this time.