This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import paho.mqtt.client as paho | |
import RPi.GPIO as GPIO | |
import json, time | |
# device credentials | |
device_id = '<DEVICE_ID>' # * set your device id (will be the MQTT client username) | |
device_secret = '<DEVICE_SECRET>' # * set your device secret (will be the MQTT client password) | |
random_client_id = '<CLIENT_ID>' # * set a random client_id (max 23 char) | |
# -------------- # |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#DEBUG="--verbose --debug" | |
hash puppet 2>/dev/null || { echo >&2 "Please install puppet"; exit 2; } | |
[ -z "$(facter | grep fqdn)" ] && { echo >&2 "Your machine has no FQDN (according to facter), some tests may fail or print warnings"; sleep 5; } | |
for dir in $(find . -type d -name tests); do | |
for file in $(find ${dir} -name '*.pp'); do | |
echo ">>> TESTING ${file}" | |
puppet apply ${DEBUG} --modulepath modules --noop "${file}" || { echo ">>> ERROR" ; HAS_FAILURES="true" ; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# most basic permission fixes | |
chmod 1777 /tmp | |
chown root:root /tmp | |
chown -R man:root /var/cache/man | |
# reinstall some core tools | |
aptitude reinstall bash | |
aptitude reinstall man-db manpages | |
aptitude reinstall dpkg apt aptitude-common apt-listchanges apt-utils aptitude debconf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for name in $(curl --silent http://dwtest:10002/search/*:* | python -m json.tool | grep '"value":' -A9999 | tail -n +2 | head -n -2 | sed 's/ /%20/g' | cut -d'"' -f2); | |
do curl --silent "http://dwtest:10002/read/$name" | python -m json.tool; | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// add your repositories here | |
buildscript { | |
repositories { | |
mavenLocal() | |
jcenter() | |
maven { | |
credentials { | |
username 'user' | |
password 'pass' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
## | |
## SETUP | |
## | |
VERSION="4.2.${BUILD_NUMBER}.yourorg" | |
REPO="https://yourorg.com/nexus/content/repositories/yourorg" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// buildscript is necessary so shadow is available within this build script. | |
// we use it to package shadow with our own plugins so the user only needs | |
// to add one dependency, because the plugins themself use shadow too. | |
buildscript { | |
repositories { | |
mavenLocal() | |
jcenter() | |
} | |
dependencies { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply plugin: 'java' | |
repositories { | |
mavenLocal() | |
mavenCentral() | |
} | |
configurations { | |
bootClassPath |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"code.google.com/p/go-tour/tree" | |
"fmt" | |
) | |
// Walk walks the tree t sending all values | |
// from the tree to the channel ch. | |
func Walk(t *tree.Tree, ch chan int) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# oneliner | |
for file in $(egrep -r "part1\.[a-Z]+\.part2" . | cut -d: -f1 | sort -u); do echo $file; awk '!(/part1/ && /part2/) { print $0 }' $file > tmp && mv tmp $file; done | |
# the same a little nicer | |
for file in $(egrep -r "part1\.[a-Z]+\.part2" . | cut -d: -f1 | sort -u); do | |
echo $file | |
awk '!(/part1/ && /part2/) { print $0 }' $file > tmp && mv tmp $file | |
done |
NewerOlder