This file contains 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
/* | |
Based on demo_userns.c by Michael Kerrisk | |
Copyright 2013, Michael Kerrisk | |
Licensed under GNU General Public License v2 or later | |
*/ | |
#define _GNU_SOURCE | |
#include <sys/wait.h> | |
#include <sys/sysmacros.h> | |
#include <sys/mount.h> |
This file contains 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
{ | |
head(list):: | |
if list == [] then | |
error 'Can not take head of empty list' | |
else | |
list[0], | |
tail(list):: | |
if list == [] then | |
error 'Can not take tail of empty list' |
This file contains 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
diff --git a/Makefile b/Makefile | |
index 54ee978..a50ee9a 100644 | |
--- a/Makefile | |
+++ b/Makefile | |
@@ -46,8 +46,8 @@ ifeq ($(USE_SYSTEM_GTEST),no) | |
GTEST_CXXFLAGS := -std=gnu++14 | |
GTEST_LIBS := gtest.a | |
else | |
-GTEST_CXXFLAGS := $(shell gtest-config --cxxflags) | |
-GTEST_LIBS := $(shell gtest-config --libs) |
This file contains 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 | |
# Helper script for development build of Nginx | |
set -e | |
NGINX_SRC=/home/dcoles/src/nginx | |
BASEDIR="$(dirname "$(realpath "$0")")" | |
cd "${BASEDIR}" | |
mkdir -p build |
This file contains 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
# Copyright 2013-2018 Sony Interactive Entertainment LLC | |
import asyncio | |
import random | |
from phue import Bridge | |
b = Bridge('10.128.12.96') | |
BEDSIDE = b.lights[0] |
This file contains 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
""" | |
Example of NFC using Windows Proximity class. | |
Tested using Sony RC-S380 (make sure you enable NFP in the driver). | |
Requires Windows 10 and Python 3.7+ (for WinRT/Python). | |
""" | |
import sys | |
import time |
This file contains 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 | |
# Run AppImage container | |
set -e | |
function _mount { | |
local target | |
target="$(mktemp --tmpdir --directory appimage.XXXXXXXXXX)" | |
/bin/mount --types squashfs -o offset="${2:-0}" --read-only -- "${1}" "${target}" | |
echo "${target}" | |
} |
This file contains 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
# Simple Wrapper around XInput API | |
# | |
# Author: David Coles <coles.david@gmail.com> | |
import ctypes | |
from ctypes.wintypes import BYTE, WORD, SHORT, DWORD | |
class XInputGamepad(ctypes.Structure): | |
_fields_ = [ |
This file contains 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
// Example of NFC using Windows Proximity APIs | |
// Tested using Sony RC-S380 (make sure you enable NFP in the driver). | |
use winrt::*; // import various helper types | |
use winrt::windows::foundation; | |
use winrt::windows::networking::proximity; | |
use std::{thread, time}; | |
const URL: &str = "https://dcoles.net"; |
This file contains 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
// Tokio-based server | |
use std::io; | |
use std::iter::FromIterator; | |
use std::time::Duration; | |
use tokio::io::{AsyncReadExt, AsyncWriteExt}; | |
use tokio::net::{TcpListener, TcpStream}; | |
// Listening server. |