Skip to content

Instantly share code, notes, and snippets.

View jkanclerz's full-sized avatar
🎯
Focusing

Jakub Kanclerz jkanclerz

🎯
Focusing
View GitHub Profile
@jkanclerz
jkanclerz / commands.sh
Last active October 26, 2016 14:52
usefull bash
#!/bin/bash
#Removes files older than 14 days from directory
#allows to set autoclean up some temp directory
find ~/Downloads/* -mtime +14 -exec rm -rf {} \;
#synchronize dirs with remote server
rsync -avz --progress user@server:/some/path ./some_local_dir
@jkanclerz
jkanclerz / fix_permission.sh
Last active November 9, 2016 09:24
Magento fix http user permission
#!/bin/bash
HTTPDUSER=`ps axo user,comm | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\ -f1`
dirs=('var' 'pub/media' 'pub/static')
function fix_permission {
sudo chmod -R +a "$HTTPDUSER allow delete,write,append,file_inherit,directory_inherit" $1
sudo chmod -R +a "`whoami` allow delete,write,append,file_inherit,directory_inherit" $1
}
@jkanclerz
jkanclerz / fix_file_dir_permissions.sh
Created December 20, 2016 13:14
Fix files dir permissions
#set 775 for all directories
find . -type d -exec chmod 775 {} \;
#set 664 for all files
find . -type f -exec chmod 664 {} \;
@jkanclerz
jkanclerz / install-ffmpeg-amazon-linux.sh
Last active May 10, 2017 15:35 — forked from prashantmaurice/install-ffmpeg-amazon-linux.sh
How to compile ffmpeg on Amazon Linux (EC2)
#!/bin/sh
# Based on gist.github.com/gboudreau/install-ffmpeg-amazon-linux.sh
# and https://trac.ffmpeg.org/wiki/CompilationGuide/Centos
if [ "`/usr/bin/whoami`" != "root" ]; then
echo "You need to execute this script as root."
exit 1
fi
cat > /etc/yum.repos.d/centos.repo<<EOF
@jkanclerz
jkanclerz / .sh
Created June 9, 2017 13:25
Clear docker images, containers
#!/bin/bash
# Delete all containers
docker rm $(docker ps -a -q)
# Delete all images
docker rmi $(docker images -q)
@jkanclerz
jkanclerz / form-ajax-submiter.js
Created April 5, 2014 23:54
file upload with progress bar
function progressHandler(event){
$("#kb_of_total").text("Uploaded "+Math.round(event.loaded/1024) +" kb of "+Math.round(event.total/1024));
var percent = (event.loaded / event.total) * 100;
$("#progressBar").attr('value', Math.round(percent));
$("#status").text(Math.round(percent)+"% uploaded... please wait");
}
function completeHandler(event){
$("#progressBar").attr('value', 100);
$("#status").text('Uploaded Success');
successHandler(event);
@jkanclerz
jkanclerz / fib.py
Created March 31, 2018 20:06 — forked from nad2000/fib.py
Threading with Python
def fib(n):
if n <= 2:
return 1
else:
return fib(n-1) + fib(n-2)
@jkanclerz
jkanclerz / table_size
Created April 30, 2018 13:22
calculate table size
SELECT CONCAT(table_schema, '.', table_name),
CONCAT(ROUND(table_rows / 1000000, 2), 'M') rows,
CONCAT(ROUND(data_length / ( 1024 * 1024 ), 2), 'M') DATA,
CONCAT(ROUND(index_length / ( 1024 * 1024 ), 2), 'M') idx,
CONCAT(ROUND(( data_length + index_length ) / ( 1024 * 1024 ), 2), 'M') total_size,
ROUND(index_length / data_length, 2) idxfrac
FROM information_schema.TABLES
ORDER BY data_length + index_length DESC
LIMIT 10

Animated SVG Avatar

Created a login form with an SVG avatar that responds to the input in the email field. Used the GSAP TweenMax library + GSAP's MorphSVG plugin for the animating.

Email validation is very simple and crude just for the purposes of getting this prototype working.

A Pen by Darin on CodePen.

License.

@jkanclerz
jkanclerz / deploy.sh
Created March 10, 2015 16:35
Remote Command Execution by ssh
#!/bin/bash
echo "deploy Was started"
hostname -f;
uptime;
for package in $@
do
echo $package
if [ "$(rpm -qa | grep -E "^$package")" != "" ]