Skip to content

Instantly share code, notes, and snippets.

View 62mkv's full-sized avatar

Kirill M 62mkv

  • Breakwater Technology
  • Tallinn, Estonia
View GitHub Profile
@62mkv
62mkv / .profile
Created March 2, 2016 07:35
What do I add on $HOME/.profile in order to have decent mc via Putty
# add this to the end of .profile file in your home directory
export LC_LANG="en_US.UTF8"
@62mkv
62mkv / convert16.sh
Created May 16, 2016 06:27
Bash script to convert all 2nd level wav files (without extension) to 16-bit wav files
#!/bin/bash
CONVERT="convert-tmp"
FILELIST=$(find . -maxdepth 2| xargs file | grep WAVE | awk -F':' '{ print $1}' | awk -F'/' '{ print $2, $3}')
while read -r line; do
FOLDER=$(echo $line | awk '{print $1}')
FILE=$(echo $line | awk '{print $2}')
INFILE="$FOLDER/$FILE"
@62mkv
62mkv / Jenkinsfile
Created October 12, 2016 12:18
Pipeline script for Android application with branch-specific config
def branch_config = [ master: [target: 'assembleStoreRelease'], qa: [target: 'assembleQaDebug']]
node {
def branch = env.gitlabSourceBranch
stage 'checkout'
checkout([$class: 'GitSCM', branches: [[name: "origin/$branch"]], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'cbd4ea7d-0718-48ae-a1dd-9dea23ac65bc', url: 'git@myhost.com:group/android.git']]])
stage 'build'
@62mkv
62mkv / extract-property-from-xml.ps1
Created October 26, 2016 06:04
Select only one property of every element of a given type in an XML-file (in PowerShell)
Select-XML -XPath "response/action/provider/@fullName" -Path providers.xml | Select-Object -ExpandProperty Node
@62mkv
62mkv / remove-merged-branches.sh
Last active October 26, 2016 06:09
Bash script to remove merged branches both locally and remotely (from "origin" only). Parses all REPOs within current folder, checkouts "master" on each of the REPOs
function remove_remote_branch() {
branch=$1
git push origin --delete $branch
}
function remove_local_branch() {
branch=$1
git branch -d $branch
}
@62mkv
62mkv / gist:26be598fe65251ebdc5fbc424f75031d
Created November 3, 2016 02:45
Show size of each subfolder
du -BM -s * | sort
@62mkv
62mkv / check-web.sh
Created November 19, 2016 13:22
check if web-server responds on request
#!/bin/bash
curl -v http://u.rl/path/; echo $?
# -v prints headers; $? is an exit code of last called command
@62mkv
62mkv / gist:43dfeee66991442d674e6b4aa5f5d7ca
Created December 27, 2016 04:00
how to run a debug-mode SSH on a separate port
/usr/sbin/sshd -p 2222 -ddd
@62mkv
62mkv / copy_as_textile.groovy
Last active February 9, 2017 09:21
Groovy script to copy FreePlane branch as Textile for easy creation of Redmine issues
import java.awt.datatransfer.*;
import java.awt.Toolkit;
/*
* Export Freeplane mindmap branch to nested list in textile format e.g. for use in Redmine wiki
* - Save as <filename>.groovy in <freeplane directory>/scripts/
- Select node and start script from menu: Tools -> Scripts -> <filename>
*
* (c) 2014 Fabian Kretzer https://dhf.sk/freeplane-mindmap-to-redmine-wiki/
* (c) 2016 62mkv
@62mkv
62mkv / gist:8f476e3a3477dddda563dbbbda3dc81f
Last active April 14, 2017 06:21
bash: sed: how to print X lines of a file starting with a line N
# show lines 1000-1010 in "filename" file
sed -n '{1000,+100p}' filename
# another option is more simplistic syntax:
sed -n 1000,+10p filename
# also display line numbers:
sed -n '1000,+10{p;=}' filename
# other useful one-liners are available here: http://sed.sourceforge.net/sed1line.txt