Skip to content

Instantly share code, notes, and snippets.

View ik5's full-sized avatar
🎯
Focusing

ik5 ik5

🎯
Focusing
View GitHub Profile
@ik5
ik5 / makerepo.sh
Last active December 21, 2015 06:19
creating yum repo
#!/bin/bash
destdir=$1
: ${destdir:=$(pwd)} # default value if $1 is not set
for ver in 5 6 ; do
for arch in SRPMS x86_64 ; do
pushd ${destdir}/${ver}/${arch} > /dev/null 2>&1
createrepo --update .
popd > /dev/null 2>&1
@ik5
ik5 / ahn
Last active August 10, 2016 03:19
Adhearsion init script
#!/bin/bash
### BEGIN INIT INFO
# Provides: ahn
# Required-Start: ahn daemon
# Required-Stop: ahn daemon
# chkconfig: 2345 91 60
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Adhearsion daemon
@ik5
ik5 / mv_recs.sh
Last active December 22, 2015 19:39
Take wav files from current directory and place them in directories based on month and day
#!/bin/bash
for i in *wav ; do
date=$(stat -c '%y' $i | cut -f 1 -d ' ' )
dir="${date:5:2}/${date:8:2}"
echo "$date $dir $i"
mkdir -p $dir
mv $i $dir
done
@ik5
ik5 / gist:6521670
Created September 11, 2013 10:06
convert recording to 8khz using ffmpeg
ffmpeg -i "<in file>" -ac 1 -ar 8000 "<out file>"
@ik5
ik5 / movie_length.sh
Created October 26, 2013 13:06
Display the duration of a movie (mp4) to screen with it's file name.
#!/bin/bash
for i in *.mp4 ; do
echo -n $(basename $i .mp4)
echo -n ": "
ffmpeg -i $i 2>&1 | grep Duration | awk '{print $2}' | tr -d ,
done
@ik5
ik5 / to_config.rb
Created January 31, 2014 15:22
Converting planet's html to planets.ini file
#!/usr/bin/env ruby
# encofing: utf-8
require 'rubygems'
require 'nokogiri'
page = Nokogiri::HTML(open('/tmp/planetfossil.htm'))
feeds = Hash.new
@ik5
ik5 / comparing_content.rb
Created March 16, 2014 07:51
Hetz request to compare two files with different lengths
#!/usr/bin/env ruby
output = open('output', 'w+')
lines = open('logfile').readlines
open('shortfile').each_line do |l|
name = l.chomp
output.puts name if lines.include? name
end
# run with: rvmsudo god -c /srv/phone/phonzy/current/ahn/config/god/adhearsion.god
# debug with: rvmsudo god quit && rvmsudo god -c /srv/phone/phonzy/current/ahn/config/god/adhearsion.god -D
@deploy_path = '/srv/phone/phonzy'
@shared_path = File.join @deploy_path, 'shared'
@app_path = File.join @deploy_path, 'current', 'ahn'
@log_path = File.join @shared_path, 'log'
@pid_path = File.join @shared_path, 'pids'
@pid_file = File.join @pid_path, 'adhearsion.pid'
@god_env = YAML.load_file("#{@shared_path}/config/god_environment.yml")
@ik5
ik5 / defer.go
Created May 28, 2014 10:12
defer in go
func open_file {
f, err := os.Open("/tmp/a_file")
if err != nil {
log.Fatal("Unable to open a_file")
}
defer f.Close()
// do something here
}
@ik5
ik5 / firebird.vim
Created June 13, 2014 19:53
Firebird SQL syntax for VIM - http://pastebin.com/DNag96VC
" Vim syntax file
" Language: SQL
" Maintainer: Scott Morgan < blumf7 at gmail dot com >
" Last Change: 2014-06-13
" Version: 1.0
" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
if version < 600
syntax clear