Skip to content

Instantly share code, notes, and snippets.

@canabady
canabady / vimtips.txt
Created December 12, 2017 06:14 — forked from kenorb/vimtips.txt
Vim Tips
__BEGIN__
*vimtips.txt* For Vim version 7.3.
------------------------------------------------------------------------------
" new items marked [N] , corrected items marked [C]
" *best-searching*
/joe/e : cursor set to End of match
3/joe/e+1 : find 3rd joe cursor set to End of match plus 1 [C]
/joe/s-2 : cursor set to Start of match minus 2
/joe/+3 : find joe move cursor 3 lines down
/^joe.*fred.*bill/ : find joe AND fred AND Bill (Joe at start of line)
@canabady
canabady / import_issues_from_github_to_taiga.ruby
Created December 19, 2017 09:53 — forked from roalcantara/import_issues_from_github_to_taiga.ruby
Importing issues from github to taiga via API
require 'json'
require 'rest-client'
puts 'Creating User Stories from github issutes.. STARTED!'
#getting github's token: https://help.github.com/articles/creating-an-access-token-for-command-line-use
github_token = "token foo"
#github params
github = {:url => 'https://api.github.com/repos/foo/foo/issues', :token => github_token}
@canabady
canabady / rename_with_increment
Last active March 6, 2018 04:26
To bulk rename files with increment or decrement
To bulk rename files with increment or decrement
================================================
e.g.
song_002.mp3
song_003.mp3
...
song_011.mp3
To rename above file list to:
@canabady
canabady / openldap-modify-acl
Last active July 13, 2022 15:22
To modify openldap ACL
########################
# To modify openldap ACL
########################
# delete the existing ACL
# delete-acl.ldif
dn: olcDatabase={1}hdb,cn=config
changetype: modify
delete: olcAccess
@canabady
canabady / sqlite-column-data-filepath-change.txt
Last active April 3, 2018 06:00
If you want to replace path in images for WooProduct kept in sqlite
If you want to replace path in images for WooProduct kept in sqlite
===================================================================
The replace ((())) does extract filename from the existing path in the images
columsn and we add base path of the server folder for accesss
SQLITE Query command is as below
--------------------------------
UPDATE local_wc_product SET Images = 'http://wordpress.com/wp-content/uploads/2018/04/' || replace(images, rtrim(images, replace(images, '/', '')),'') WHERE Images IS NOT NULL;
@canabady
canabady / keyboard_layout in lxde
Last active October 18, 2018 11:12
To set English and Tamil keyboard layout in lxde
# To set English and Tamil keyboard layout in lxde, add the below line to ~/.bashrc
setxkbmap -option grp:switch,grp:lwin_toggle,grp_led:scroll -layout "us,in" -variant "basic, tam_keyboard_with_numerals"
@canabady
canabady / filter-files-from json-2-create-ebook.sh
Last active November 20, 2018 04:33
To filter id and title from json file and output to html for ebook creation
# Select id and title from JSON File based on TEXT_TO_SEARCH and append it to OUTPUT.html
$ for f in $(find $PWD -name "JSON_FILE.json"); do idTitleTextArray=($(cat $f | jq -r -c '.categories[].articles[] | select(.title | contains("TEXT_TO_SEARCH"))|"\(.id).html\">\(.title)</a>"'|sort)); if [ ${#idTitleTextArray[@]} -gt 0 ];then echo "<a href=\"${f%/*}/web/html/${idTitleTextArray[@]}" >> OUTPUT.html; fi; done;
# Create MOBI ebook from HTML
$ ebook-convert OUTPUT.html OUTPUT.mobi
@canabady
canabady / list-month-names-in-bash
Last active November 21, 2018 10:03
List month names in Title case, Lower case and Upper case
# List month names in Title case, Lower case and Upper case
$ for i in {1..12}; do month=$(date -d "$i/01" +%b); echo "${month} ${month,,} ${month^^}"; done
# Output
# Jan jan JAN
# Feb feb FEB
# Mar mar MAR
# Apr apr APR
# May may MAY
# Jun jun JUN
@canabady
canabady / only-one-thevara-pathigam-temples.sql
Last active December 5, 2018 15:20
Thevara Temple that have only one pathigam
# List all temples that have only one pathigam order by thirumurai
sqlite> select koil_name_ta, cast(thirumurai_1 as integer) as t1,cast(thirumurai_2 as integer) as t2, cast(thirumurai_3 as integer) as t3,cast(thirumurai_4 as integer) as t4,cast(thirumurai_5 as integer) as t5,cast(thirumurai_6 as integer) as t6,cast(thirumurai_7 as integer) as t7 from koil_pathigam WHERE ((thirumurai_1 is not null and COALESCE (thirumurai_2,thirumurai_3,thirumurai_4,thirumurai_5,thirumurai_6,thirumurai_7) is null) or (thirumurai_2 is not null and COALESCE(thirumurai_1,thirumurai_3,thirumurai_4,thirumurai_5,thirumurai_6,thirumurai_7) is null) or (thirumurai_3 is not null and COALESCE(thirumurai_1,thirumurai_2,thirumurai_4,thirumurai_5,thirumurai_6,thirumurai_7) is null) or (thirumurai_4 is not null and COALESCE(thirumurai_1,thirumurai_2,thirumurai_3,thirumurai_5,thirumurai_6,thirumurai_7) is null) or (thirumurai_5 is not null and COALESCE(thirumurai_1,thirumurai_2,thirumurai_3,thirumurai_4,thirumurai_6,thirumurai_7) is nu
@canabady
canabady / open url in docker chrome
Last active July 16, 2019 03:53
To open a url from other application into running docker based chrome
# Docker, Chrome and Ubuntu
# When the chrome container exists and it is running, to open a url in it from other applications
if [ "$CHROME_RUNNING" == "false" ]; then
docker start chrome
else
docker exec chrome sh -c "/usr/bin/google-chrome '$@' --user-data-dir=/data" &> /dev/null
fi
# Source: https://tuttlem.github.io/2015/10/08/docker-chrome-and-ubuntu.html