Skip to content

Instantly share code, notes, and snippets.

View jarpy's full-sized avatar
💚

Nina Dowland jarpy

💚
  • Elastic
  • Adelaide
  • 07:39 (UTC +09:30)
View GitHub Profile
@jarpy
jarpy / gist:8b209615563c4cb2bec9
Last active August 29, 2015 14:16
Count outstanding upgrades on a Debian/dpkg/Aptitude system.
aptitude safe-upgrade --simulate --assume-yes | awk -F ' ' '/[0-9]+ packages upgraded/ {print $1}'
@jarpy
jarpy / gist:75f1ada8eee09873a423
Last active August 29, 2015 14:18
Enviroment variables in Puppet Exec.
$secret = 'SESAME'
exec {'read_secret_variable':
command => '/bin/echo $ENVSECRET > /tmp/secret',
environment => "ENVSECRET=$secret"
}
# $ cat /tmp/secret
# SESAME
@jarpy
jarpy / logstash-forwarder-init.debian.sh
Last active August 29, 2015 14:21
Minimal init scripts for logstash-forwarder on RedHat and Debian.
#! /bin/sh
### BEGIN INIT INFO
# Provides: logstash-forwarder
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start daemon at boot time
# Description: Enable service provided by daemon.
root@salt:~# salt --async '*' cmd.run 'date ; sleep 10; date'
Executed command with job ID: 20150716111845948627
root@salt:~# salt --async '*' cmd.run 'date ; sleep 10; date'
Executed command with job ID: 20150716111847963330
root@salt:~# salt-run jobs.lookup_jid 20150716111845948627
debian7:
Thu Jul 16 11:18:45 AEST 2015
Thu Jul 16 11:18:55 AEST 2015
@jarpy
jarpy / remove-crapware.ps1
Created March 23, 2016 13:17
[WIP] Remove crapware from Windows 10
Get-AppxPackage | Select-String Zune | Remove-AppxPackage
Get-AppxPackage | Select-String Camera | Remove-AppxPackage
Get-AppxPackage | Select-String onenote | Remove-AppxPackage
Get-AppxPackage | Select-String phone | Remove-AppxPackage
Get-AppxPackage | Select-String photos | Remove-AppxPackage
Get-AppxPackage | Select-String BingSport | Remove-AppxPackage
Get-AppxPackage | Select-String Microsoft.People | Remove-AppxPackage
Get-AppxPackage | Select-String BingWeather | Remove-AppxPackage
Get-AppxPackage | Select-String WindowsSoundRecorder | Remove-AppxPackage
Get-AppxPackage | Select-String WindowsStore | Remove-AppxPackage
apt-get -y update
apt-get -y install apt-transport-https ca-certificates
apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
echo 'deb https://apt.dockerproject.org/repo ubuntu-trusty main' > /etc/apt/sources.list.d/docker.list
apt-get -y update
apt-get -y install docker-engine
service docker start
docker run hello-world
#!/usr/bin/env python
import RPi.GPIO as GPIO
import picamera
import subprocess
# Set up a pin on the GPIO connector for the "record" button.
# We'll use pin 18, which is here:
#
# ....X........
@jarpy
jarpy / purge-docker.sh
Last active September 12, 2016 06:55
Violently clean up Docker
# Remove all containers, inluding those that are not running.
docker ps --quiet | xargs docker kill
docker ps --all --quiet | xargs docker rm
# Remove all images.
docker images --format '{{.ID}}' | xargs docker rmi --force
Oct 13, 2016 4:01:37 AM jnr.netdb.NativeProtocolsDB load
WARNING: Failed to load native protocols db
java.lang.UnsatisfiedLinkError: Symbol not found: Java_com_kenai_jffi_Foreign_dlerror
at jnr.ffi.provider.jffi.AsmRuntime.newUnsatisifiedLinkError(AsmRuntime.java:40)
at jnr.netdb.NativeProtocolsDB$LinuxLibProto$jnr$ffi$1.getprotobyname_r(Unknown Source)
at jnr.netdb.NativeProtocolsDB$LinuxNativeProtocolsDB.getProtocolByName(NativeProtocolsDB.java:176)
at jnr.netdb.NativeProtocolsDB.load(NativeProtocolsDB.java:80)
at jnr.netdb.NativeProtocolsDB.access$000(NativeProtocolsDB.java:40)
at jnr.netdb.NativeProtocolsDB$SingletonHolder.<clinit>(NativeProtocolsDB.java:47)
at jnr.netdb.NativeProtocolsDB.getInstance(NativeProtocolsDB.java:43)
@jarpy
jarpy / bootstrap.cmd
Created November 8, 2016 22:43
Bootstrap Windows with Puppet and Chocolatey
@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin
choco install puppet-agent
puppet module install chocolatey/chocolatey