View trans_gif.sh
#!/bin/sh
# Convert video to gif.
if [[ $# -ne 3 ]]; then
echo "Usage: trans_gif source.mp4 target.gif 300"
exit 1
fi
palette="/tmp/palette.png"
filters="fps=15,scale=$3:-1:flags=lanczos"
View jlpt_slack.rb
#!/usr/bin/ruby
exit(0) if File.exists?('/root/.jlpt_sent')
require 'net/https'
require 'json'
require 'open-uri'
require 'hpricot'
SLACK_URL = "https://hooks.slack.com/services/xxxxx"
View SwiftyGohan 16-8-7 22-53.crash
Incident Identifier: 2D2808D0-F71F-4C68-AFDD-639175C4239E
CrashReporter Key: 153f5645627079591a0e528446a69296c17f523e
Hardware Model: iPhone7,1
Process: SwiftyGohan [2132]
Path: /private/var/containers/Bundle/Application/B8888313-A544-4101-8868-62BE35A49A4E/SwiftyGohan.app/SwiftyGohan
Identifier: me.imach.SwiftyGohan
Version: 596 (2.2)
Code Type: ARM-64 (Native)
Parent Process: launchd [1]
View mavericks_bootable_iso.sh
#!/usr/bin/env bash
# Original: http://thezinx.com/2013/10/29/create-bootable-dmg-iso-mavericks-app.html
V_BUILD=/Volumes/install_build
V_APP=/Volumes/install_app
T_SI_B=/tmp/mavericks
T_SI=$T_SI_B.sparseimage
View ipv6-regex-test.sh
#!/bin/sh
#
# Use posixregex CLI tool from: https://github.com/syzdek/dmstools/blob/master/src/posixregex.c
RE_IPV4="((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])"
posixregex -r "^(${RE_IPV4})$" \
127.0.0.1 \
10.0.0.1 \
192.168.1.1 \
View Contents.swift
//: Playground - noun: a place where people can play
import Foundation
import Darwin
let regex = UnsafeMutablePointer<regex_t>.alloc(1)
let regexString = "^[[:alnum:]]+$"
let regex_str = regexString.cStringUsingEncoding(NSUTF8StringEncoding)!
if (regcomp(regex, regex_str, REG_ICASE | REG_EXTENDED) != 0) {
View test.c
#include <stdio.h>
#include <stdlib.h>
#include <regex.h>
#include <unicode/uregex.h>
int main(int argc, char const *argv[])
{
regex_t regex;
if (regcomp(&regex, "\\w+", REG_ICASE | REG_EXTENDED)) {
printf("Error compile\n");
View tl.rb
#!/usr/bin/env ruby
require 'twitter'
require 'open-uri'
require 'open_uri_redirections'
client = Twitter::REST::Client.new do |config|
config.consumer_key = "riOPILJqG0AtzB8x7hiqRA"
config.consumer_secret = "uBlaPxB3QONvCyvvq78CY9UjpHYdxYdeEb0d1QAaU"
config.access_token = "191735866-EHC4Xbf5O6fSu62CI72Hk1PPQ6d0Jn81sMWkWF9p"
View mkiso.rb
#!/usr/bin/env ruby
require 'fileutils'
require 'shellwords'
include FileUtils
#hdiutil makehybrid -iso -joliet -o image.iso /path/to/source
ARGV.each do |rootdir|
cd rootdir do
Dir["*"].each do |subdir|
destination = "/Volumes/WD3T/ISOs/#{rootdir.shellescape}/"
View clearup.rb
#!/usr/bin/env ruby
require 'fileutils'
include FileUtils
BAD_FILES = ['@eaDir', 'Thumbs.db']
def transverse(dir)
cd dir do
Dir["*"].each do |d|