Skip to content

Instantly share code, notes, and snippets.

View DavidEGrayson's full-sized avatar

David Grayson DavidEGrayson

View GitHub Profile
@DavidEGrayson
DavidEGrayson / patch.sh
Last active May 17, 2017 14:09
How to fix libstdc++v3 to not use __in and __out, which conflict with Microsoft.
sed -ri 's/\b(__in|__out)\b/_&/g' $(egrep -rl '\b(__in|__out)\b' libstdc++-v3/{include,config})
@DavidEGrayson
DavidEGrayson / setuperr.log
Last active March 13, 2017 16:58
$Windows.~BT\Sources\Panther\setuperr.log file that I got after attempting to update Windows using the Media Creation Tool. See https://superuser.com/questions/1188252/cannot-update-windows-10-get-winload-efi-error-0xc0000225
2017-03-12 14:22:46, Error MOUPG CDlpActionImpl<class CDlpErrorImpl<class CDlpObjectInternalImpl<class CUnknownImpl<class IMoSetupDlpAction> > > >::Suspend(1066): Result = 0xC1800104
2017-03-12 14:22:46, Error MOUPG CSetupManager::ExecuteInstallMode(735): Result = 0x800705BB
2017-03-12 14:22:46, Error MOUPG CSetupManager::ExecuteDownlevelMode(391): Result = 0x800705BB
2017-03-12 14:22:46, Error MOUPG CSetupManager::Execute(236): Result = 0x800705BB
2017-03-12 14:22:46, Error MOUPG CSetupHost::Execute(372): Result = 0x800705BB
2017-03-12 14:43:08, Error SP pSPRemoveUpgradeRegTree: failed to delete reg tree HKLM\SYSTEM\Setup\Upgrade[gle=0x00000005]
2017-03-12 14:43:16, Error [0x080831] MIG CSIAgent: Invalid xml format: FormatException: "id" attribute is mandatory. void __cdecl Mig::CMXEMigrationXml::LoadSupportedComponent(class UnBCL::XmlNode *,int,class Mig::CMXEMigrationXml *,class Mig::CMXEXmlComp
@DavidEGrayson
DavidEGrayson / send_email.rb
Created January 16, 2017 23:34
Ruby script for sending email
require 'net/smtp'
Net::SMTP.start("mail1.pololu.com", nil, 'alderaan.tmphax.com') do |smtp|
from = "david@tmphax.com"
to = "david@pololu.com"
message = <<END
From: david@tmphax.com
To: david@pololu.com
Subject: just a test of our serer's firewall
@DavidEGrayson
DavidEGrayson / nixpkgs-pr-test.nix
Last active December 24, 2016 05:37
Test file for version 2 of my Nix cross-compiling pull request: https://github.com/NixOS/nixpkgs/pull/21388
rec {
pkgsFunMine = import ./nixpkgs/pkgs/top-level;
releaseCross = import ./nixpkgs/pkgs/top-level/release-cross.nix;
pkgsFunBase = import ((import <nixpkgs> { }).fetchFromGitHub {
owner = "NixOS";
repo = "nixpkgs";
rev = "1590461887333e2fda46f4bd74aef3785b253089";
sha256 = "0c446b6kamn4nvg729vd081w5560rsgplchi1m3l4cplz7w84l92";
} + "/pkgs/top-level");
WTF, I did something that affected the architecture of my cross-built ELF files?
base = d4eac0278ca188aa236b6a7f0fbb15f8ee4273d0
me = 9cedf1b7a794e70706804b7239807f39c0a76ecb
degzeg = downloaded from the URL in nixpks
$ objdump -x bootstrap_degzeg/busybox | grep arch
architecture: arm, flags 0x00000102:
$ objdump -x bootstrap_base/busybox | grep arch
@DavidEGrayson
DavidEGrayson / I2CBus.cpp
Last active October 6, 2016 17:18
Better I2CBus.cpp. I want to integrate this into minimu9-ahrs.
#include "I2CBus.h"
#include <cerrno>
#include <cstring>
#include <system_error>
#include <string>
#include <unistd.h>
#include <fcntl.h>
#include <linux/i2c-dev.h>
static inline std::system_error posix_error(const std::string & what)
rec {
myNixpkgsFunc = import ./nixpkgs;
myNixpkgs = myNixpkgsFunc {};
baseNixpkgsFunc = import ((import <nixpkgs> { }).fetchFromGitHub {
owner = "NixOS";
repo = "nixpkgs";
rev = "d4eac0278ca188aa236b6a7f0fbb15f8ee4273d0";
sha256 = "0mpx6bjvix7dfmgn6a2chmmicamz9v941fki0lgzfk2gw90fqg6w";
});
@DavidEGrayson
DavidEGrayson / drvdiff
Created September 1, 2016 04:18
Shell script for comparing two Nix derivations to see the differences between them.
#!/usr/bin/bash
set -ue
A="$1"
B="$2"
diff -u <(tr ',' '\n' <"$A") <(tr ',' '\n' <"$B")
@DavidEGrayson
DavidEGrayson / vulnerabilities.txt
Created August 27, 2016 01:29
David's list of weird web exploits
* dev.to noopener
* CSS Blend mode whack a mole reveals history
* cross-site image tag reveals which sites you are logged into
@DavidEGrayson
DavidEGrayson / pain.md
Last active September 14, 2016 00:37
Pain caused by using pacman in MSYS2, which would never happen in a hypothetical system using Nix.
  1. Packages with undeclared dependencies:
  1. Packages where rebuilding with a later version causes a DLL name to change, breaking another package:
  1. Packages that interfere with the building of another package:
  • libusb-compat provides usb.h, causing a name collision with mingw-w64 which broke the build of usbview and any other software using native Windows USB headers
  1. Packages that cannot be installed at the same time:
  1. Packages that should have been rebuilt a long time ago to benefit from bugfixes