Skip to content

Instantly share code, notes, and snippets.

anonymous
anonymous / mqttjogglermashup.c
Created February 11, 2013 09:16
Simply publishes the Joggler light level reading to MQTT.
/*
* Basic mash up of Andrew de Quincey's Joggler light sensor code
* and sample MQTT client code to publish light sensor reading
* messages.
* For more info. see:
* http://code.google.com/p/adqmisc/source/browse/trunk/joggler/readlightsensor.c
* http://www.eclipse.org/paho/files/mqttdoc/Cclient/
* http://jtlog.wordpress.com/2013/02/07/mqtt-joggler/
*/
#include "stdio.h"
@kennwhite
kennwhite / vpn_psk_bingo.md
Last active February 24, 2024 12:19
Most VPN Services are Terrible

Most VPN Services are Terrible

Short version: I strongly do not recommend using any of these providers. You are, of course, free to use whatever you like. My TL;DR advice: Roll your own and use Algo or Streisand. For messaging & voice, use Signal. For increased anonymity, use Tor for desktop (though recognize that doing so may actually put you at greater risk), and Onion Browser for mobile.

This mini-rant came on the heels of an interesting twitter discussion: https://twitter.com/kennwhite/status/591074055018582016

@Jakobud
Jakobud / Vagrantfile
Last active July 28, 2017 21:27
Vagrant Windows 260 character path limit workaround
# If you are using Windows as your Vagrant host OS, there is a limitation in Windows where any given folder path
# cannot be more than 260 characters long. This becomes a problem with Vagrant because, for example, if you
# install a Linux guest environment and try to create a deep directory structure in a synced folder, Linux will
# throw errors. This is because the synced folder is under the constraints of the Windows host. A common example
# of this happening is when installing node.js modules. NPM is known for creating some very long, deep
# folder paths because each node depenency has it's own dependencies, which have their own dependencies, etc...
#
# This gist solves the problem and works around the Windows 260 character path limit. Add it to your Vagrantfile.
#
# NOTE: This bug in Vagrant was fixed in 1.7.3, but reverted back in 1.7.4 due to some regression bugs.
@StevenACoffman
StevenACoffman / Docker Best Practices.md
Last active April 29, 2024 08:36
Docker Best Practices

Mistakes to Avoid: Docker Antipatterns

Whichever route you take to implementing containers, you’ll want to steer clear of common pitfalls that can undermine the efficiency of your Docker stack.

Don’t run too many processes inside a single container

The beauty of containers—and an advantage of containers over virtual machines—is that it is easy to make multiple containers interact with one another in order to compose a complete application. There is no need to run a full application inside a single container. Instead, break your application down as much as possible into discrete services, and distribute services across multiple containers. This maximizes flexibility and reliability.

Don’t install operating systems inside Docker containers

It is possible to install a complete Linux operating system inside a container. In most cases, however, this is not necessary. If your goal is to host just a single application or part of an application in the container, you need to install only the essential

#!/usr/bin/env bash
CLEARING_VERSION=0.2.6
TMP_DIR=$(mktemp -d)
echo "Temp directory: ${TMP_DIR}"
# stop rest servers
for i in $(ps x| grep composer-rest-server | awk '{print $1}'); do
kill $i
@mbwhite
mbwhite / gist:668494565bf0b155c6fb60627f9deb09
Created October 15, 2019 09:46
2.0 LIfecycle cheat sheet
## Cheat Sheet for sequence of commands for v2.0 lifecycle and byfn
docker kill $(docker ps -q) && docker rm $(docker ps -aq)
docker rmi $(docker images dev-* -q) --force
docker volume prune -f && docker network prune -f
./byfn.sh generate
./byfn.sh restart
# org1 ->
docker exec -it cli bash
@relyt0925
relyt0925 / provision_ubuntu2004_qemu_macosx.sh
Created May 14, 2020 04:50
Provisions a Ubuntu 20.04 VM in QEMU on Mac OSX using Cloud-Init
#!/usr/bin/env bash
#Install brew and qemu + cloud init metadata dependencies
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
brew install qemu
brew install cdrtools
rm -rf /tmp/ubuntuqemuboot
#download Ubuntu 20.04 Cloud Image and resize to 30 Gigs
mkdir -p /tmp/ubuntuqemuboot/images
@mbwhite
mbwhite / versions.js
Created January 19, 2021 11:30
Very simple query of IBP using the node sdk
// Apache-2
// Import and IBP Node SDK, and also two cli helpers
const ibp = require('ibp-node-sdk');
const { table } = require('table');
const chalk = require('chalk');
// package JSON contains
// "chalk": "^4.1.0",
// "ibp-node-sdk": "^0.1.11",
@magnetikonline
magnetikonline / README.md
Last active May 3, 2024 12:20
Install jq on macOS from source.

Install jq on macOS from source

Note: as of jq v1.7 the project offers pre-built native macOS releases for ARM64 based architechtures.

A quick n' dirty Bash script to install the following:

  • autoconf.
  • automake.
  • libtool
  • jq - from source.
@mbwhite
mbwhite / commands
Last active May 5, 2023 04:58
WSL2 - docker buildx
# start docker - this is a helper script created to start docker as wsl2 doesn't use systemd
docker-start
ping github.com
# why a ping here? emperiically I've determined this has to occur
# otherwise for me the docker daemon messes up dns.
# don't know why, ymmv
wget https://gist.githubusercontent.com/ArturKlauser/0f0293c62f5626df0261ac994d8a46af/raw/d5863dfc22e6d65fd912c9ec760dcdc86ea320cc/check-qemu-binfmt.sh
chmod +x check-qemu-binfmt.sh