Skip to content

Instantly share code, notes, and snippets.

Avatar
🌤️
The sun is behind every cloud

Fedir RYKHTIK fedir

🌤️
The sun is behind every cloud
View GitHub Profile
@fedir
fedir / latlng_parse.sh
Last active Dec 16, 2015
Latitude and longitude parsing from string into variables #shell #geo
View latlng_parse.sh
#!/bin/bash
LATLNG="(53.3096,-6.28396)"
LAT=$(echo "$LATLNG" | sed -e "s/(\(.*\),\(.*\))/\1/g" )
LON=$(echo "$LATLNG" | sed -e "s/(\(.*\),\(.*\))/\2/g")
echo "Lat : $LAT"
echo "Lng : $LON"
View svnupdry.sh
#!/bin/bash
svn merge --dry-run -r BASE:HEAD .
@fedir
fedir / svndiffup.sh
Last active Dec 16, 2015
Show SVN diff between current code and incoming changes
View svndiffup.sh
#!/bin/bash
svn diff -rBASE:HEAD myfilename
@fedir
fedir / gist-backup.py
Last active Apr 7, 2020 — forked from nicerobot/backup.sh
Clone or update all user's gists #backup #github #gists #management
View gist-backup.py
#!/usr/bin/env python
# Clone or update all a user's gists
# curl -ks https://raw.github.com/gist/5466075/gist-backup.py | USER=fedir python
# USER=fedir python gist-backup.py
import json
import urllib
from subprocess import call
from urllib import urlopen
import os
View test_site_availiability.sh
while ! curl -m 10 http://www.example.com/ ; do echo still down ; sleep 10 ; done ; play alarm.wav # Play alarm.wav once site is back.
@fedir
fedir / say_hello.sh
Created May 2, 2013
Vocal messages from shell # Inspired by @climagic
View say_hello.sh
#!/bin/bash
echo "Hello ! I'm the robot" | ( espeak || say -v F ) > /dev/null 2>&1
@fedir
fedir / get_size_without_svn.sh
Created May 2, 2013
Get some folder size without .svn folders # svn #subversion #usage #statistics
View get_size_without_svn.sh
#!/bin/bash
du -h --exclude=".svn" --max-depth=0 "/home/www/path/" 2>"/dev/null"
@fedir
fedir / checkDatabaseTablesSize.sh
Last active Feb 22, 2018
Shows a dB tables size in MB #mysql #shell
View checkDatabaseTablesSize.sh
#!/bin/sh
# shows a dB tables size in MB
# usage : checkDatabaseTablesSize.sh databasename
# mysql : SELECT TABLE_NAME,(DATA_LENGTH+INDEX_LENGTH)/1024/1024 FROM information_schema.TABLES WHERE table_schema="dbname";
DATABASE=$1
mysql -e "SELECT TABLE_NAME,(DATA_LENGTH+INDEX_LENGTH)/1024/1024 FROM information_schema.TABLES WHERE table_schema=\"${DATABASE}\";"
@fedir
fedir / removeSvn.sh
Created May 6, 2013
Removes .svn from some path #shell #svn
View removeSvn.sh
#!/bin/bash
find $1 -name .svn -exec echo {} \;
read -p "These files are near to be removed. Continue (y/n)?" choice
case "$choice" in
y|Y )
find $1 -name .svn -exec rm -rf {} \;
;;
* )
echo "No files removed"
@fedir
fedir / import_mysql_csv.sql
Last active Dec 17, 2015
An example of advanced import into MySQL database using LOAD DATA INFILE #mysql #csv
View import_mysql_csv.sql
/**
*
* An example of advanced import into MySQL database using LOAD DATA INFILE
*
* import of first and second column from the file directly
* third column is equal to current datetime
* fourth column is transformed value of third column of csv file
* ref. : http://dev.mysql.com/doc/refman/5.1/en/load-data.html
*/