Mislav Marohnić mislav

View backfill-releases.sh
1 2 3 4 5 6 7 8 9 10
#!/bin/bash
# Usage: OAUTH_TOKEN="..." backfill-releases CHANGELOG.md [<project-title>]
 
set -e
 
log="${1?}"
project_name="${2}"
 
repo="$(git config remote.origin.url | grep -oE 'github\.com[/:][^/]+/[^/]+' | sed 's/\.git$//' | cut -d/ -f2-3)"
[ -n "${project_name}" ] || project_name="${repo#*/}"
View randomize_mac.sh
1 2 3 4 5 6 7 8 9 10
mac_randomize() {
MAC_ORIGINAL="$(ifconfig en0 ether | grep ether | awk '{print $2}')"
sudo ifconfig en0 ether `openssl rand -hex 6 | sed "s/\(..\)/\1:/g; s/.$//"`
}
 
mac_restore() {
if [[ -z $MAC_ORIGINAL ]]; then
echo "no original MAC address" >&2
return 1
else
View h264.rb
1 2 3 4 5 6 7 8 9
#!/usr/bin/env ruby
# Usage: h264 input.avi 12:34-13:45,21:43-22:54 output-%d.mp4
input, trim, outfile = ARGV
outfile, trim = trim, nil unless outfile
 
abort "no input file" unless input
abort "no output file" unless outfile
 
bitrate = "900k" # 1200
View watch.rb
1 2 3 4 5 6 7 8 9
require 'guard'
 
listener = Guard::Listener.select_and_init '/',
:relativize_paths => false,
:ignore_paths => ['Caches', 'Saved Application State']
 
listener.on_change do |files|
p files
end
View detect_encoding.sh
1 2 3 4
ruby -r pp -r charlock_holmes -e '
contents = ARGF.read
detection = CharlockHolmes::EncodingDetector.detect(contents)
pp detection ' "$@"
View bash_profile.sh
1 2 3 4 5 6 7 8 9 10
_git_prompt() {
local ref="$(command git symbolic-ref -q HEAD 2>/dev/null)"
if [ -n "$ref" ]; then
echo " (${ref#refs/heads/})"
fi
}
 
_failed_status() {
[ "$PIPESTATUS" -ne 0 ] && printf "$"
}
View addressbook2vcard.rb
1 2 3 4 5 6 7 8 9 10
# Usage: addressbook2vcard /path/to/AddressBook.sqlitedb
#
# Reads contact info from iPhone OS 4.1 Address Book database and outputs it as
# VCard 3.0 for easy import in other programs.
 
require 'sqlite3'
 
String.class_eval do
def present?
!strip.empty?
View git-promote.sh
1 2 3 4 5 6 7 8 9 10
#!/bin/sh
# Usage: git promote [<remote>[/<branch>]]
#
# Pushes the current branch to remote.
 
set -e
 
branch="$(git symbolic-ref --short HEAD)"
remote="${1%/*}"
remote_branch="${1#*/}"
View FormMetadata.js
1 2 3 4 5 6 7 8 9 10
// Keep in sync with FormAutoFillTypes.h
const UndeterminedAutoFillFormType = 0;
const AutoFillableStandardForm = 1;
const NonAutoFillableForm = 2;
const AutoFillableLoginForm = 3;
const NewAccountOrChangePasswordForm = 4;
 
ASSERT = function(assertion, message)
{
if (!FormMetadataJSController.canWriteToConsole())
View steal.sh
1 2 3 4 5 6 7 8 9 10
#!/bin/sh
# Usage: steal <YOUTUBE-URL>
# Requirements: youtube-dl, ffmpeg
set -e
 
# strip the YouTube playlist
url="${1%%&*}"
 
if [ -z "$url" ]; then
echo "no URL given" >&2
Something went wrong with that request. Please try again.