Skip to content

Instantly share code, notes, and snippets.

View ipoddubny's full-sized avatar

Ivan Poddubny ipoddubny

  • ipnordic
  • Denmark
View GitHub Profile
@ipoddubny
ipoddubny / convert.sh
Created February 4, 2013 06:54
Convert mp3 files into Asterisk native format
#!/bin/bash
# converts .mp3 files in current directory into .sln Asterisk 16-bit signed linear audio
for f in *.mp3; do
lame --decode $f;
done
for f in *.wav; do
sox $f -t raw -r 8000 -b 16 -c 1 ${f%.wav}.sln
rm $f
@ipoddubny
ipoddubny / git-cleanup.sh
Created February 5, 2013 08:08
Rewriting history with git filter-branch
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# !!! Don't forget to backup first !!!
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# !!! Everyone who has forked from your repository will need to start over !!!
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# removing .settings folder and .project file
git filter-branch --index-filter 'git ls-files -- .settings .project | xargs git update-index --remove' --tag-name-filter cat --prune-empty -f -- --all
@ipoddubny
ipoddubny / ks-pre-dialog.py
Created February 5, 2013 13:55
Asking user for confirmation from RedHat kickstart pre-installation script
%pre --interpreter /usr/bin/python
# -*- coding: utf-8 -*-
import os, sys
from snack import *
def set_tty(n):
f = open('/dev/tty%d' % n, 'a')
os.dup2(f.fileno(), sys.stdin.fileno())
os.dup2(f.fileno(), sys.stdout.fileno())
os.dup2(f.fileno(), sys.stderr.fileno())
@ipoddubny
ipoddubny / dahdi_list_echoc.sh
Created March 29, 2013 09:24
Find supported DAHDI echocancellation modules for the running kernel
#!/bin/bash
find /lib/modules/`uname -r` -name 'dahdi_echo*' | sed 's/^.*dahdi_echocan_//;s/.ko$//'
@ipoddubny
ipoddubny / forvz.sh
Last active December 16, 2015 12:28
Execute command for all OpenVZ containers
#!/bin/sh
containers=`vzlist | sed '1d' | awk '{print $1}'`
for c in $containers; do
vzctl exec $c $@
done
@ipoddubny
ipoddubny / ipoddubny.asc
Created July 6, 2013 10:07
My public PGP key
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.13 (GNU/Linux)
mQENBFHWf4kBCADA5R23TaSpsAq2duHb7COjMkTLfXkHm1hM/a3+6Qpj/jbIJPZw
qmdW+aXcQeIhJTud6Jy5aZ/bZ3lQ1yuyf+LOiMe1+U1gFgFscFFcwpSPxccAhHgK
mVSrflhSYi6bHkRaMvS1OUnipCZELgHvuKat1bUDBe5gmtYWWwIIhrBmX80/EdZf
zHk1uoKaC+C/8JLx4ZlYHqrRpB3/gJ4emGsjNY6NpdN7QDRydB3lCw8/i1TPqnwo
0YBg5sKYoUoRrjoy4mmTw4laDm6GPvi8VqcoQvGCqk4pZAcv3BucRI+ZsRjRUJhD
xUx+stLsv8+HUdQKE+6mcvVi6AKKGrzjUKVdABEBAAG0J0l2YW4gUG9kZHVibnkg
PGl2YW4ucG9kZHVibnlAZ21haWwuY29tPokBOAQTAQIAIgUCUdZ/iQIbAwYLCQgH
@ipoddubny
ipoddubny / extensions.conf
Created June 22, 2014 06:56
Asterisk Multifon configuration
[incoming]
exten => 7926XXXXXXX,1,Versobe(Hello Multifon)
same => n,NoOp(Call from ${CALLERID(num)})
; do something, like answer, ...
same => n,Hangup
[outbound]
exten => _89XXXXXXXXX,1,Dial(SIP/multifon/${EXTEN})
same => n,Hangup
@ipoddubny
ipoddubny / ipconfig.md
Last active November 14, 2024 11:51
How to get public IP address from Linux shell

http

curl ifconfig.co
curl icanhazip.com
curl ifconfig.me
curl http://smart-ip.net/myip

telnet

@ipoddubny
ipoddubny / getdata.sh
Last active April 3, 2024 06:48
Импорт базы abc, def-кодов и операторов с сайта Россвязи и поиск номеров в ней. Обновлено 13.07.2019
#!/bin/bash
function getCSV {
echo "Downloading $1..."
curl -s https://rossvyaz.ru/data/$1.csv |\
iconv -f cp1251 -t utf8 |\
sed -e 's/[[:space:]]*;[[:space:]]*/;/g' -e '/^$/d' |\
awk '{ split($0,a,";"); print a[1] ";" a[2] ";" a[3] ";" a[4] ";" a[5] ";" a[6] ", " a[7] ", " a[8] ", " a[9] ", " a[10] }' |\
sed -e 's/\(,[[:space:]]\)*$//' > $2.csv
}
@ipoddubny
ipoddubny / amd.js
Last active February 11, 2024 22:33
webpack amd and cjs mixture
define(['cjs'], function (cjs) {
console.log('amd module loaded');
console.log('cjs exported:', cjs);
return 'AMD';
});