Skip to content

Instantly share code, notes, and snippets.

View pavel-arapov's full-sized avatar
🍩
Sweet

Pavel Arapov pavel-arapov

🍩
Sweet
View GitHub Profile

Keybase proof

I hereby claim:

  • I am pavel-arapov on github.
  • I am aspid (https://keybase.io/aspid) on keybase.
  • I have a public key ASDKud_2NH93xU-G89ELSTEiWbrckZmQUntl1DS81mVCDAo

To claim this, I am signing this object:

@pavel-arapov
pavel-arapov / sshkey_upload.sh
Last active February 4, 2016 23:18
Upload public ssh key to remote server
#!/bin/bash
if [ -z "$1" ]; then
echo usage: $0 user@server
exit
fi
echo "uploading key to $1";
cat ~/.ssh/id_rsa.pub | ssh $1 'cat > key.pub && [ -d .ssh ] || mkdir .ssh && [ -d .ssh/autorized_keys2 ] || touch .ssh/autorized_keys2 && cat key.pub >> ~/.ssh/authorized_keys2 && rm key.pub'
@pavel-arapov
pavel-arapov / size_of_tables.sql
Created November 26, 2014 05:54
Calculation the size of all tables in a database order from max to min size
# {database} to change
SELECT table_name AS "Tables",
round(((data_length + index_length) / 1024 / 1024), 2) "Size in MB"
FROM information_schema.TABLES
WHERE table_schema = "{database}"
ORDER BY (data_length + index_length) DESC;
@pavel-arapov
pavel-arapov / gzip_static_files.sh
Created August 11, 2014 13:58
Create gzip version of static files
#!/bin/bash
FILETYPES=( "*.html" "*.css" "*.js" "*.xml" "*.txt" )
DIRECTORIES="/path/to/site/dir/"
MIN_SIZE=512
for currentDir in $DIRECTORIES;
do
for f in "${FILETYPES[@]}";
do
files="$(find $currentDir -iname "$f")";

Deploy your site with git

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by apache
  • apache's home directory is /var/www/