Skip to content

Instantly share code, notes, and snippets.

@ymauray
ymauray / usefull-git-commands-and-workflow.md
Created December 12, 2017 09:34
Usefull git commands and workflow

Usefull git commands and workflow

Set "vi" as the default editor

git config --global core.editor "vi"

Prepare a branch to work on fixes (assuming master is always a clone of upstream/master) :

@ymauray
ymauray / xcode-build-bump.sh
Created August 18, 2017 18:29 — forked from sekati/xcode-build-bump.sh
Xcode Auto-increment Build & Version Numbers
# xcode-build-bump.sh
# @desc Auto-increment the build number every time the project is run.
# @usage
# 1. Select: your Target in Xcode
# 2. Select: Build Phases Tab
# 3. Select: Add Build Phase -> Add Run Script
# 4. Paste code below in to new "Run Script" section
# 5. Drag the "Run Script" below "Link Binaries With Libraries"
# 6. Insure that your starting build number is set to a whole integer and not a float (e.g. 1, not 1.0)
import UIKit
extension UIImage {
// colorize image with given tint color
// this is similar to Photoshop's "Color" layer blend mode
// this is perfect for non-greyscale source images, and images that have both highlights and shadows that should be preserved
// white will stay white and black will stay black as the lightness of the image is preserved
func tint(tintColor: UIColor) -> UIImage {
#!/bin/sh
### BEGIN INIT INFO
# Provides: firewall
# Required-Start: $network
# Required-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Sets/unsets iptables rules
# Description: Sets/unsets iptables rules.
# This script will set/unset iptables rules.
@ymauray
ymauray / monitor.py
Created February 20, 2017 16:56
Monitor for iDJC patched with the "on-air" signal
#! /usr/bin/python2.7
"""monitor.py
Monitors events from iDJC.
Requires IDJC 0.8.11 or higher.
Takes the profile you wish to monitor as the command line parameter.
"""
#! /bin/bash
sudo apt-get install build-essential libc6-dev libglib2.0-dev libjack-dev jackd libvorbis-dev libsamplerate0-dev libsndfile1-dev python-gtk2-dev libmpg123-dev libavcodec-dev libavformat-dev libtwolame-dev libmp3lame-dev libflac-dev python-mutagen libspeex-dev git-core autoconf libtool autopoint imagemagick libtool-bin
mkdir ~/dev
cd ~/dev
mkdir ffmpeg
cd ffmpeg/
mkdir archive
cd archive
wget http://ffmpeg.org/releases/ffmpeg-3.2.4.tar.bz2

Keybase proof

I hereby claim:

  • I am ymauray on github.
  • I am ymauray (https://keybase.io/ymauray) on keybase.
  • I have a public key whose fingerprint is 2CDF 2AB0 3B53 F39A 9039 BE87 4A11 A1BE 3115 C919

To claim this, I am signing this object:

<?php
$api_request = 'http://.......';
$api_response = wp_remote_get( $api_request );
$api_data = json_decode( wp_remote_retrieve_body( $api_response ), true );
@ymauray
ymauray / extract_video.sh
Created July 15, 2016 19:34
How to cut a video file on black keyframes
# Re-encode source video with one keyframe every 5 frames
ffmpeg -i source.mkv -g 5 tmp.mkv
# Search black frames
ffmpeg -i tmp.mkv -vf blackframe -f null -
# Use output to locate black frames right on keyframes
# Then cut video at those keyframes
ffmpeg -i tmp.mkv -ss 6.089 -to 180.263 -c copy tmp2.mkv
#! /bin/bash
a=/tmp/xx/file.tar.gz
# /tmp/xx
xpath=${a%/*}
# file.tar.gz
xbase=${a##*/}