Skip to content

Instantly share code, notes, and snippets.

View bblanchon's full-sized avatar
🌟
No more counting dollars we’ll be counting stars

Benoît Blanchon bblanchon

🌟
No more counting dollars we’ll be counting stars
View GitHub Profile
@bblanchon
bblanchon / Dockerfile
Last active October 18, 2015 16:51
Dockerfile for Domoticz
# docker build -t bblanchon/domoticz .
# docker run --device /dev/ttyACM0 -p 80:8080 bblanchon/domoticz
FROM ubuntu:14.04
MAINTAINER bblanchon
# install dependencies
RUN apt-get update && \
apt-get install -y \
build-essential \
@bblanchon
bblanchon / GitExecutableFlag.sh
Last active August 8, 2023 13:53
Git: add executable flag to *.sh
find . -name '*.sh' | xargs git update-index --chmod=+x
@bblanchon
bblanchon / Azure_CaptureVm.ps1
Created September 2, 2015 15:03
Azure: Capture a VM
$ErrorActionPreference = "Stop"
Add-AzureAccount
Select-AzureSubscription -Name "Continuous Integration"
Write-Host 'The following VM instances are available:'
Get-AzureVM | foreach { $_.Name }
$vmName = Read-Host 'Enter the name of the VM to capture'
Write-Host 'The following VM images are available:'
@bblanchon
bblanchon / Azure_RemoveAllVms.ps1
Created September 2, 2015 10:07
Azure: delete all VMs of a subscription
Add-AzureAccount
Select-AzureSubscription -SubscriptionName "Continuous Integration"
Get-AzureVM | Remove-AzureVM -DeleteVHD -Verbose
@bblanchon
bblanchon / checksums.sh
Last active September 18, 2015 15:19
Compute checksums of files in each folder recursivlty
find $(pwd) -type d | while read DIR
do
cd $DIR
FILES=$(find -maxdepth 1 -type f -not -name '*SUMS' -printf '"%f"\n' | sort)
FILE_COUNT=$(echo $FILES | wc -c)
if [ -z "$FILES" ]
then
rm -f *SUMS
else
echo $FILES | xargs md5sum > MD5SUMS
@bblanchon
bblanchon / JsonGeneratorReference.ino
Created August 20, 2015 14:03
Reference program for JSON generator's size
void setup() {
Serial.begin(9600);
Serial.println("{\"sensor\":\"gps\",\"time\":1351824120,\"data\":[48.756080,2.302038]}");
Serial.println("{\n \"sensor\": \"gps\",\n \"time\":1351824120,\n \"data\": [\n 48.756080,\n 2.302038\n ]\n}");
}
void loop() {
// not used in this example
@bblanchon
bblanchon / JsonParserReference.ino
Created August 20, 2015 13:55
Reference program for JSON parser's size
void setup() {
Serial.begin(9600);
char json[] =
"{\"sensor\":\"gps\",\"time\":1351824120,\"data\":[48.756080,2.302038]}";
const char* sensor = "gps";
long time = 1351824120;
double latitude = 48.756080;
double longitude = 2.302038;
@bblanchon
bblanchon / delete-vm-status.ps1
Created July 1, 2015 12:43
Azure delete VM status blobs
Get-AzureStorageBlob -Container vhds | Where { $_.Name -like "*.status"} | Remove-AzureStorageBlob
@bblanchon
bblanchon / grep-lib
Created April 15, 2015 12:54
Check for symbol presence in a lib file
nm -U -j lib<mylib>.a | grep <myfunc> | c++filt
@bblanchon
bblanchon / update-ghost
Created April 14, 2015 20:20
Automatically upgrade Ghost
#
# Automatically upgrade Ghost
# Benoit Blanchon 2014-2015 - MIT License
set -eu
GHOST_DIR=/var/www/blog.benoitblanchon.fr
function ghost_version {