Skip to content

Instantly share code, notes, and snippets.

View edhemphill's full-sized avatar

Ed Hemphill edhemphill

  • Izuma Networks
  • Austin, TX
View GitHub Profile
@edhemphill
edhemphill / install-docker.sh
Last active December 15, 2023 17:28
Install docker Debian / Ubuntu - script
#!/bin/bash
# remove any Debian stuff
for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do sudo apt-get remove $pkg; done
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl gnupg
sudo install -m 0755 -d /etc/apt/keyrings
@edhemphill
edhemphill / regextest.cpp
Created February 3, 2012 18:35
ICU4C regex example test program w/ capture groups
// http://www.wigwag.com/devblog/using-icu4c-regex-test-program/
// The following code is freeware:
// regextest.c
// Author: ed
//
// Simple test program for regex using ICU's regex matching.
#include <stdio.h>
#include <getopt.h>
#include <string.h>
@edhemphill
edhemphill / setup-cross-node.sh
Last active December 24, 2021 11:31
A script to help you setup a cross compile shell to build node.js
#!/bin/sh -e
#
# WigWag LLC
# License: this script is public domain
#
# This will setup a shell to cross compile node.js (node 0.8 working for us) using cross tools
# Example uses a Freescale tool chain...
# Adjust vars below to your taste and good luck
@edhemphill
edhemphill / backup-to-s3.sh
Last active February 6, 2021 15:08
Use Duplicati for Backup to S3 on Ubuntu Server
#!/bin/bash
#
# You need Duplicati installed
# First on Ubuntu it uses mono :( unfortunately:
# apt-get install mono-runtime
# get the latest Duplicati 2.0 - go here--> http://www.duplicati.com/download
# wget https://updates.duplicati.com/experimental/duplicati_2.0.1.30-1_all.deb
# sudo dpkg -i duplicati_2.0.1.30-1_all.deb
#
# After install you will have a 'duplicati-cli' which is a script which runs the mono program: Duplicati.CommandLine.exe
@edhemphill
edhemphill / fifo.go
Last active April 30, 2020 13:06
Thread / goroutine safe, batching and blocking FIFO queue in golang
import (
"net/http"
"sync"
"fmt"
)
type logBuffer struct {
stuff string
}
@edhemphill
edhemphill / texample.cpp
Created February 28, 2012 22:43
C++ threaded extension for node.js w/ gyp build
// Originally at:
// http://bravenewmethod.wordpress.com/2011/03/30/callbacks-from-threaded-node-js-c-extension/
#include <queue>
// node headers
#include <v8.h>
#include <node.h>
#include <ev.h>
#include <pthread.h>
Number of platforms 1
Platform Name AMD Accelerated Parallel Processing
Platform Vendor Advanced Micro Devices, Inc.
Platform Version OpenCL 2.0 AMD-APP (2482.3)
Platform Profile FULL_PROFILE
Platform Extensions cl_khr_icd cl_amd_event_callback cl_amd_offline_devices
Platform Extensions function suffix AMD
Platform Name AMD Accelerated Parallel Processing
Number of devices 1
var resourceID = "VirtualTemperature74";
var temperature;
var currentlyRaised = false;
function raiseAlert() {
dev$.alert('Temperature Too Low', 'warning', true, {
temp: temperature
});
currentlyRaised = true;
log.info('Temperature Too Low, alert raised!!');