Skip to content

Instantly share code, notes, and snippets.

@mherwig
mherwig / LOC.sh
Last active May 19, 2020 22:56
Shell script for counting the total physical source lines of code (LOC)
#!/bin/bash
#
# Author: Mike Herwig
# Description:
# Shell script for counting the total physical source lines of code (LOC)
#
# example: ./LOC.sh java h cpp xml
ARG_COUNT=1
@mherwig
mherwig / masscopy-assistent.zenity.sh
Last active October 13, 2015 05:37
Assistent for copying easily content from a selected directory to several selected USB-devices in few steps
#!/bin/bash
# Author: Mike Herwig
# Version: v12.8-24
# Beschreibung: Assistent for copying easily content from a selected directory to several selected USB-devices in few steps.
#
# Edited by Kai Jansen
# Added unmountFinishedSticks and getSudo Function
#
# Translation (for github:gist) by Mike Herwig
@mherwig
mherwig / HttpImage
Last active December 11, 2015 09:49
HttpImage is set of tools for sending photos to devices like tablets or phone via HTTP. There is an android app for receiving and displaying photos and there is an optional shell script that is able to send photos to these android devices right after you take a photo with a camera connected to your PC or your Raspberry Pi
HttpImage Listener (Android):
You can send images via cURL to an android device running HttpImage Listener:
e.g.: curl -F [email protected] http://192.168.0.2
The follwoing options are available:
nohandler=true just save image, don't display
customapp=true let's you choose the app for handling the image
e.g: curl -d nohandler=true -F [email protected] http://192.168.0.2
@mherwig
mherwig / VoiceControl.sh
Last active December 11, 2015 23:18 — forked from anonymous/gs_sp_to_txt.sh
Simple voice control demonstration using google's speech-api. For demonstration purpose I added the unix commands 'ls' and 'whoami' that map to the spoken phrases "List directory" and "Who am I?"
#!/bin/bash
#
# Author: Mike Herwig
# Description:
# Updated voice control demonstration using google's speech-api
# The main difference to the previous script I uploaded to my Gist is that it's using sox for recording now
# and only records your voice to the disc when sox detects sound
# Dependencies: sox, wget
LANG="en"
@mherwig
mherwig / tarcp.sh
Created February 13, 2014 13:26
Copy a folder to another using tar. This way you can easily (one-way) synchronize whole folders and exclude files e.g. .metadata
#!/bin/bash
#
# Author: Mike Herwig
# Description:
# Copy a folder to another using tar.
# This way you can easily (one-way) synchronize whole folders and exclude files e.g. .metadata
#
# Usage:
# tarcp ~/directory1" "~/directory2
@mherwig
mherwig / SwitchAudio.vbs
Last active August 29, 2015 13:56
SwitchAudio.vbs is a script for switching between two audio devices in Microsoft Windows. You need NirCmd for this script to work (download it here: http://www.nirsoft.net/utils/nircmd.html). Please read my comment in this gist for further instructions.
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set deviceNamesTextFile = objFSO.OpenTextFile("devices.txt", 1)
ReDim deviceNames(1)
Do Until deviceNamesTextFile.AtEndOfStream
deviceNames(UBound(deviceNames) - 1) = deviceNamesTextFile.ReadLine
ReDim Preserve deviceNames(UBound(deviceNames) + 1)
Loop
deviceNamesTextFile.Close
@mherwig
mherwig / casperjs-scraping-example.js
Last active August 29, 2015 14:19
Example for web scraping using CasperJS/SlimerJS
// Usage: casperjs --ssl-protocol=any --engine=slimerjs paypal.js
// Open in browser: http://localhost:8083/get
var email = '',
password = '';
var casper = require('casper').create({
verbose: true,
logLevel: "debug"
}),
mkdir -p /synology/tarballs
cd /synology/tarballs
wget https://global.synologydownload.com/download/ToolChain/toolkit/7.1/base/base_env-7.1.txz
wget https://global.synologydownload.com/download/ToolChain/toolkit/7.1/apollolake/ds.apollolake-7.1.dev.txz
wget https://global.synologydownload.com/download/ToolChain/toolkit/7.1/apollolake/ds.apollolake-7.1.env.txz
wget https://global.synologydownload.com/download/ToolChain/Synology%20NAS%20GPL%20Source/7.1.1-42962/apollolake/linux-4.4.x.txz
mkdir /synology/env
cd /synology/env