Skip to content

Instantly share code, notes, and snippets.

Avatar

Tim Harper timcharper

View GitHub Profile
@timcharper
timcharper / README.md
Last active Jul 29, 2020
Macvlan using systemd
View README.md

Before

yum install -y systemd-networkd
modprobe macvlan # make sure this returns no errors

Put config files in place

eth0.network and mac0.{netdev,network} go in /etc/systemd/network/

@timcharper
timcharper / mem.py
Created May 13, 2020
Allocate n mb per second
View mem.py
#!/usr/bin/env python3
from time import sleep
from sys import exit, argv, getsizeof
# this simple python script allocates memory, waits for a while, and then exits successfully
mem = 0
allocs = []
try:
mem = int(argv[1])
except ValueError:
print("Usage: mem.py <mb-to-allocate-per-cycle>")
View mem.py
#!/usr/bin/env python3
from time import sleep
from sys import exit, argv, getsizeof
# this simple python script allocates memory, waits for a while, and then exits successfully
mem = 0
try:
mem = int(argv[1])
except ValueError:
print("Usage: mem.py <mb-to-allocate>")
exit()
View apnea-plots.R
require("tidyverse")
require("ggplot2")
require("dplyr")
## install.packages("tidyverse")
require("lubridate")
pressure_begin6 = as.Date("2019-11-01")
pressure_begin10 = as.Date("2019-12-09")
pressure_begin6_r2 = as.Date("2019-12-23")
pressure_begin10_r2 = as.Date("2020-01-03")
View docs-marathon.log
Nov 19 18:44:23 ip-....internal marathon.sh[10865]: [2019-11-19 18:44:23,612] INFO Migration for storage: Version(18, 200, 0, PERSISTENCE_STORE) to target: Version(19, 300, 0, PERSISTENCE_STORE): apply change for version: Version(19, 200, 0, PERSISTENCE_STORE) (mesosphere.marathon.storage.migration.Migration:scala-execution-context-global-65)
Nov 19 18:44:23 ip-....internal marathon.sh[10865]: [2019-11-19 18:44:23,646] INFO Starting migration to 1.9.200 (mesosphere.marathon.storage.migration.MigrationTo19200:scala-execution-context-global-64)
Nov 19 18:44:23 ip-....internal marathon.sh[10865]: [2019-11-19 18:44:23,698] INFO Leadership ended with failure; exiting (mesosphere.marathon.core.election.ElectionServiceImpl:marathon-akka.actor.default-dispatcher-4)
Nov 19 18:44:23 ip-....internal marathon.sh[10865]: mesosphere.marathon.MigrationFailedException: while migrating storage to major: 19
Nov 19 18:44:23 ip-....internal marathon.sh[10865]: minor: 200
Nov 19 18:44:23 ip-....internal marathon.sh[10865]: pa
View gist:471b4f354a1fe893e7fbc12c591fdd56
➜ ~ diskutil list
/dev/disk0 (internal, physical):
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *1.0 TB disk0
1: Windows Recovery 554.7 MB disk0s1
2: EFI NO NAME 104.9 MB disk0s2
3: Microsoft Reserved 16.8 MB disk0s3
4: Microsoft Basic Data 1.0 TB disk0s4
@timcharper
timcharper / lein-completion.bash
Created Apr 15, 2010
bash completion for leiningen
View lein-completion.bash
_lein_test()
{
local curw
COMPREPLY=()
curw=${COMP_WORDS[COMP_CWORD]}
if [ -d test ]; then
COMPREPLY=($(compgen -W '$(cd test; find * -name \*.clj | sed "s/.clj\$//" | sed "s/_/-/g" | sed "s|/|.|g")' -- $curw));
return 0
fi
}
View nailgun-build-failure.log
➜ nailgun git:(master) mvn package
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] nailgun-all [pom]
[INFO] nailgun-server [jar]
[INFO] nailgun-examples [jar]
[INFO]
[INFO] ----------------------< com.facebook:nailgun-all >----------------------
View gist:9b81696bd78314f19c3e2c7446d29f47
var long lastNotified = 0
var String lastReceipt
rule "Alert for bad air"
when
Item Master_Air_Pm25 changed or System started
then
val pm25 = (Master_Air_Pm25.state as Number).intValue
logDebug("air-quality", "pm25 = {}", pm25)
if ((now.millis - lastNotified) > 3600000) {
if (pm25 >= 15) {
View pmstest.ino
#define _DEBUG
unsigned int pm1 = 0;
unsigned int pm2_5 = 0;
unsigned int pm10 = 0;
long lastPmReading = 0;
byte buffer[24];
void setup() {
You can’t perform that action at this time.