This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
tempfile=$(mktemp /tmp/cjit.XXXXXXXXXX) | |
gcc -x c -o "$tempfile" - <<EOL | |
#include <stdio.h> | |
int main(void) { | |
puts("Welcome to the future of programming!"); | |
return 0; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Compile with -DUSE_READLINE and -lreadline to use readline for input. */ | |
#include <arpa/inet.h> | |
#include <errno.h> | |
#include <poll.h> | |
#include <signal.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <sys/socket.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# This requires nativefier to be installed, so do that first: | |
# https://github.com/jiahaog/nativefier | |
# I know this uses javascript, which is evil, but it must be done :( | |
# You'll also need to download an image, which is used as input | |
# for this script. Specify a path to a PNG. | |
# A .desktop entry is included with this script; you may need to | |
# modify it depending on where you place the packaged output. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python3 | |
# this script requires beautifulsoup4 | |
# --> pip3 install bs4 | |
# this script also requires requests | |
# --> pip3 install requests | |
# TODO make this work on linux | |
from urllib.request import urlopen |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Working example: https://godbolt.org/z/UNnxAy | |
// Find the nth Fibonacci number | |
constexpr unsigned fib(unsigned n) { | |
unsigned a = 0; | |
unsigned b = 1; | |
for (unsigned i = 1; i < n; i++) { | |
a ^= b, b ^= a, a ^= b; | |
b += a; | |
} | |
return a; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const uint32_t crc[] = { | |
0, 4c11db7, 9823b6e, d4326d9, | |
130476dc, 17c56b6b, 1a864db2, 1e475005, | |
2608edb8, 22c9f00f, 2f8ad6d6, 2b4bcb61, | |
350c9b64, 31cd86d3, 3c8ea00a, 384fbdbd, | |
4c11db70, 48d0c6c7, 4593e01e, 4152fda9, | |
5f15adac, 5bd4b01b, 569796c2, 52568b75, | |
6a1936c8, 6ed82b7f, 639b0da6, 675a1011, | |
791d4014, 7ddc5da3, 709f7b7a, 745e66cd, | |
9823b6e0, 9ce2ab57, 91a18d8e, 95609039, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# File: svnsettle | |
# Author: Will Eccles | |
# Date: 2019-08-14T07:42R | |
# Description: This script takes any unknown files in an SVN repo (not counting | |
# ignored ones, obviously) and adds them. If there are any missing files, it | |
# will remove them from SVN. Note that this is not necessarily a perfect | |
# solution, but it does what I wanted it to. It's definitely not the cleanest |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# 0 would disable the fn key altogether | |
# 2 has the effect of setting the keys to be F keys by default | |
# while still being able to use fn to get play/pause/home/end etc. | |
echo 2 | sudo tee /sys/module/hid_apple/parameters/fnmode |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* bmp2arduino.cs | |
* Will Eccles 2019 | |
* | |
* Takes a Windows bitmap file and outputs a C header containing a bitmap array | |
* to be used with the Adafruit GFX library. Only works for monochrome files at this time. | |
* All pixels that are not black or transparent are assumed to be white. | |
* | |
* Run with no arguments to see usage. | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <fstream> | |
#include <string> | |
#include <vector> | |
#include <sstream> | |
#include <cstdlib> | |
#include <cstring> | |
int instr_mov( | |
const std::string& arg1, |