Skip to content

Instantly share code, notes, and snippets.

View colatkinson's full-sized avatar
👽
ayy lmao

Colin Atkinson colatkinson

👽
ayy lmao
View GitHub Profile
@colatkinson
colatkinson / doesnt_compile_on_monday.c++
Created July 9, 2019 03:19
C++ file that fails to compile on Monday
#include <stdio.h>
// Some definitions for calculation
#define SEC_PER_MIN 60UL
#define SEC_PER_HOUR 3600UL
#define SEC_PER_DAY 86400UL
#define SEC_PER_YEAR (SEC_PER_DAY*365)
// extracts 1..4 characters from a string and interprets it as a decimal value
#define CONV_STR2DEC_1(str, i) (str[i]>'0'?str[i]-'0':0)
@colatkinson
colatkinson / CMakeLists.txt
Created March 26, 2019 04:01
Example of building libnice with vcpkg
project(libnice_pkg_test C)
cmake_minimum_required(VERSION 3.12)
find_path(NICE_INCLUDE_DIR PATH_SUFFIXES nice NAMES agent.h)
find_library(NICE_LIBRARY libnice)
find_path(GLIB_INCLUDE_DIR glib.h)
find_library(GLIB_LIBRARY glib-2.0)
find_library(GOBJECT_LIBRARY gobject-2.0)
find_library(GIO_LIBRARY gio-2.0)
@colatkinson
colatkinson / elf_sigs.sh
Created December 30, 2016 22:03
A Bash script to sign and verify ELF executables with embedded GPG signatures
#!/bin/sh
function verify_file {
unsig_exe_tmp=`mktemp`;
# Remove the signature from the file and save to disk
objcopy --remove-section=sigdata $1 $unsig_exe_tmp;
# Extract the signature and verify it against the unsigned executable
objcopy --dump-section sigdata=/dev/stdout $1 | gpg --verify - $unsig_exe_tmp;

Keybase proof

I hereby claim:

  • I am colatkinson on github.
  • I am colatkinson (https://keybase.io/colatkinson) on keybase.
  • I have a public key whose fingerprint is 1E2E DB1E DEA6 56B5 934D 3AAA 5E56 35D5 498F 3950

To claim this, I am signing this object:

@colatkinson
colatkinson / oracle_speech.ino
Created July 13, 2015 20:31
My horrible code from my speaking oracle project
/*
* speaker_pcm
*
* Plays 8-bit PCM audio on pin 11 using pulse-width modulation (PWM).
* For Arduino with Atmega168 at 16 MHz.
*
* Uses two timers. The first changes the sample value 8000 times a second.
* The second holds pin 11 high for 0-255 ticks out of a 256-tick cycle,
* depending on sample value. The second timer repeats 62500 times per second
* (16000000 / 256), much faster than the playback rate (8000 Hz), so
@colatkinson
colatkinson / GtkMainWindow.cpp
Created July 19, 2014 14:38
An attempt to make DnD work in more places
#include "GtkAddMagnetLinkWindow.hpp"
#include <gtkmm/filechooserdialog.h>
#include "GtkMainWindow.hpp"
#include <Application.hpp>
#include <gtkmm/button.h>
#include <gtkmm/hvseparator.h>
#include <gtkmm/stock.h>
#include <glibmm.h>
#include <giomm.h>
from PIL import Image
from optparse import OptionParser
def key_func(arr):
# Sort the pixels by luminance
r = 0.2126*arr[0] + 0.7152*arr[1] + 0.0722*arr[2]
return r