Skip to content

Instantly share code, notes, and snippets.

@riyad
riyad / android-backup.md
Last active November 22, 2018 11:35
Backup and Restore your Android Phone With ADB

Android-Backup

NOTE: this project has moved to https://github.com/riyad/android-backup

Backup and restore your Android phone with ADB (and rsync)

It will backup and restore all of your /sdcard directory and any other storage (e.g. an external SD Card) mounted within /storage except for emulated and self). Assuming you're using also something like Titanium Backup you'll be able to backup and restore all your apps, settings and data.

@riyad
riyad / another-intermediate-ca_csr.json
Last active November 17, 2018 22:35
Using CFSSL building your own CA and generating service specific key, cert and chain files.
{
"CN": "Another Intermediate CA",
"hosts": [
""
],
"key": {
"algo": "ecdsa",
"size": 384
},
"names": [
@riyad
riyad / magicdict.py
Last active November 17, 2018 22:32
MagicDict
# -*- coding: utf-8 -*-
#
# Author: Riyad Preukschas <riyad@informatik.uni-bremen.de>
# License: Mozilla Public License 2.0
#
from collections import defaultdict
class MagicDict(defaultdict):
@riyad
riyad / extract-audio.sh
Last active November 17, 2018 22:19
Extract audio from any media file ffmpeg can play into a new one (without converting or reencoding!)
#!/bin/sh
#
# Author: Riyad Preukschas <riyad@informatik.uni-bremen.de>
# License: Mozilla Public License 2.0
#
# Extract audio from any file ffmpeg can play (without converting or reencoding!).
if [[ $# -ne 3 ]]; then
echo "Error: wrong number of arguments"
@riyad
riyad / ffmpeg-cut
Last active November 17, 2018 22:16
Cut out a part of a media file within the given time stamps (without converting or reencoding!)
#!/bin/bash
#
# Author: Riyad Preukschas <riyad@informatik.uni-bremen.de>
# License: Mozilla Public License 2.0
#
# Cuts out a part of a media file within the given time stamps (without converting or reencoding!).
set -o nounset # complain when reading unset vars
# set -o xtrace # print every command as it's executed
@riyad
riyad / ffmpeg-mp3-converter.rb
Last active November 17, 2018 22:14
Small scripts to transcode any file VLC or ffmpeg can play to mp3.
#!/usr/bin/env ruby -rubygems
#
# Author: Riyad Preukschas <riyad@informatik.uni-bremen.de>
# License: Mozilla Public License 2.0
#
# Transcode any file ffmpeg can play to mp3.
require 'optparse'
require 'shellwords'
@riyad
riyad / flot-sparklines-demo.html
Last active April 25, 2017 15:14
flot-sparklines element for Polymer (with Demo)
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<title>Flot Sparklines for Polymer</title>
<link rel="stylesheet" href="bower_components/semantic-ui/dist/semantic.min.css">
@riyad
riyad / README.md
Last active April 6, 2017 15:56
a helper for creating list of 'HH:MM' for the `at` option of `Clockwork.every` with alignment and hour ranges

Use this in your clock.rb file:

require 'clockwork'

include ClockHelper

module Clockwork
  # ...
 every 1.day, "do_something", at: steps(every: 3.hours, aligned_at: '01:32') do
@riyad
riyad / gitlab_config_changer.sh
Created December 15, 2012 00:47
Automatically change GitLab's configs for https://github.com/gitlabhq/gitlabhq/pull/2247
#!/bin/bash
for f in `grep -rl Gitlab.config app config features lib spec`
do
for c in `cat gitlab_config_keys.list`
do
mv $f $f.bak
perl -pe $c $f.bak > $f
rm -f $f.bak
done
@riyad
riyad / Gemfile
Created February 23, 2011 10:56
How to setup your Rails app for using the declarative_authorization gem
source 'http://rubygems.org'
gem 'rails', '3.0.3'
...
gem 'declarative_authorization'
group :development do
# for the graphical overview over your rules
# available at /authorization_rules