Skip to content

Instantly share code, notes, and snippets.

View fedir's full-sized 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 December 16, 2015 15:49
Latitude and longitude parsing from string into variables #shell #geo
#!/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"
#!/bin/bash
svn merge --dry-run -r BASE:HEAD .
@fedir
fedir / svndiffup.sh
Last active December 16, 2015 15:59
Show SVN diff between current code and incoming changes
#!/bin/bash
svn diff -rBASE:HEAD myfilename
@fedir
fedir / gist-backup.py
Last active March 29, 2023 16:27 — forked from nicerobot/backup.sh
Clone or update all user's gists #backup #github #gists #management
#!/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
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 08:57
Vocal messages from shell # Inspired by @climagic
#!/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 15:29
Get some folder size without .svn folders # svn #subversion #usage #statistics
#!/bin/bash
du -h --exclude=".svn" --max-depth=0 "/home/www/path/" 2>"/dev/null"
@fedir
fedir / checkDatabaseTablesSize.sh
Last active February 22, 2018 18:24
Shows a dB tables size in MB #mysql #shell
#!/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 15:55
Removes .svn from some path #shell #svn
#!/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 December 17, 2015 06:39
An example of advanced import into MySQL database using LOAD DATA INFILE #mysql #csv
/**
*
* 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
*/