Skip to content

Instantly share code, notes, and snippets.

@show0k
show0k / batch_clean_web_image
Last active August 29, 2015 14:01
Convertir en pgm, redimenssioner et rennomer un lot d'images venant du web (téléchargés sur google image avec l'extension de firefox DownloadThemAll) pour l'exploiter dans un algo de traitement d'image
#!/bin/bash
#
# Usage : bash script.sh directory_of_my_pictures
#
dir=$1
# Need to make a function to allow "cd"
@show0k
show0k / morse.ino
Created May 21, 2014 23:16 — forked from madc/LICENSE
//Define the LED Pin
#define PIN_OUT 9
//Define unit length in ms
#define UNIT_LENGTH 250
//Build a struct with the morse code mapping
static const struct {const char letter, *code;} MorseMap[] =
{
{ 'A', ".-" },
{ 'B', "-..." },
/*
* Arduino library for the MMA8452Q three-axis accelerometer.
*
* The MMA8452Q is a tiny and low-power three-axis accelerometer. This
* library implements a simple interface to access most of the chip
* functionality from an Arduino.
*
* FEATURES:
* + Normal and fast raw axes values reading
* + Scale configuration (allowed 2g, 4g and 8g scales)
@show0k
show0k / find_words.py
Created April 23, 2015 09:54
Bruteforce word with a specified separator
def find_words(instring, words, prefix=''):
""" Quick and dirty snippet to split string without space
to a list of known words.
Used to pass over a bug of Snap!"""
if not instring:
return []
if (not prefix) and (instring in words):
return [instring]
prefix, suffix = prefix + instring[0], instring[1:]
@show0k
show0k / monitor.bash
Created June 2, 2015 14:59
live usb dubugging
tail -f /var/log/kern.log
@show0k
show0k / rsync_backup.sh
Last active August 29, 2015 14:24
backup to a remote shell with Rsync (keep rights and dates to files, can be rexecuted if trasnfer failed)
rsync -arzvvPh dir/to/backup user@host.local:/remote/dir
# you can use also -files-from=to_be_backuped.txt with a list of directories
@show0k
show0k / clean_files_for_windows.bash
Last active August 29, 2015 14:24
Clean files for windows (remove illegal characters)
find . -name "*[<>:\\|?*]*" -exec bash -c 'x="{}"; y=$(sed "s/[<>:\\|?*]\+/-/g" <<< "$x") && mv "$x" "$y" && echo "change $x to $y"' \;
@show0k
show0k / ffmpeg.bash
Created November 25, 2015 12:43
Ffmpeg scripts
# encode a MTS (from a Canon photo camera video file) to an Avi
ffmpeg -i file.mts -acodec copy -vcodec libx264 -crf 21 -r 30000/1001 -deinterlace -y -threads 0 file.avi
@show0k
show0k / .bash_profile
Last active March 6, 2016 20:18
My bash profile, with some hints for OSX
# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management
#!/usr/bin/env python
"""
build_conda_packages.py creates conda packages for the specified recipe for all operating systems and python versions.
Usage:
anaconda login --user USER --password PASSWORD
python build_conda_packages.py ANACONDA_USER --destination-path conda_recipe/build/ --recipe-path conda_recipe/
where: