Skip to content

Instantly share code, notes, and snippets.

View KINKCreative's full-sized avatar

Klemen KINKCreative

  • Los Angeles, CA
View GitHub Profile
@KINKCreative
KINKCreative / gist:9755697
Last active August 29, 2015 13:57
Magento - Backup and Restore DB from Command Line
# CREATE CATEGORIES IN YOUR SYSTEM (MEN/WOMEN/KIDS and WOMEN/SHOES, WOMEN/JEWELRY, MEN/SHOES and KIDS/SHOES)
# Update the ID's in the top of shopify_import.php ($category)
# BACKUP
sudo mysqldump -p magentodb > magentodb.sql
#this saves the whole DB, incl users and categories
#switch to shopify-import branch, pull
#on your local machine run shopify_import.php, for me it's
@KINKCreative
KINKCreative / gist:9756270
Created March 25, 2014 06:37
Magento Create New Admin User
<?php
/*
Put this file into your root folder. Set the user settings below and run the script. It will auto-delete when done.
*/
$mageFilename = 'app/Mage.php';
if (!file_exists($mageFilename)) {
@KINKCreative
KINKCreative / gist:9945072
Created April 2, 2014 23:00
Some Magento MySQL Commands
# GET RECENTLY UPDATED TABLES
SELECT UPDATE_TIME, TABLE_NAME FROM `TABLES` WHERE TABLE_SCHEMA = 'magentodb' ORDER BY UPDATE_TIME DESC;
@KINKCreative
KINKCreative / gist:9981268
Created April 4, 2014 19:12
Git Undo a commit and redo
$ git commit ... (1)
$ git reset --soft 'HEAD^' (2)
$ edit (3)
$ git add .... (4)
$ git commit -c ORIG_HEAD (5)
This is what you want to undo
This is most often done when you remembered what you just committed is incomplete, or you misspelled your commit message, or both. Leaves working tree as it was before "reset". (The quotes may or may not be required in your shell)
Make corrections to working tree files.
@KINKCreative
KINKCreative / gist:10002815
Created April 6, 2014 08:04
Update git version on Ubuntu 12.04
# First add python-software-properties to get apt-add-repository
$ sudo apt-get install python-software-properties
# then...
$ sudo add-apt-repository ppa:git-core/ppa
$ sudo apt-get update
$ sudo apt-get install git
@KINKCreative
KINKCreative / gist:10189059
Created April 8, 2014 20:44
Fix Magento redirect to old site
# OPEN MYSQL
$ sudo mysql -p
# SWITCH TO YOUR MAGENTO DATABASE
mysql> use magentodb
# IF YOU WANT TO CHECK COLUMN NAMES
mysql> SELECT `COLUMN_NAME`FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE `TABLE_SCHEMA`='magentodb' AND `TABLE_NAME`='core_config_data';
@KINKCreative
KINKCreative / gist:10224621
Last active October 1, 2018 14:07
Varnish - remove Vary: User-Agent header
// ADD TO YOUR VCL FILE
sub vcl_fetch {
if (beresp.http.Vary ~ "User-Agent") {
set beresp.http.Vary = regsub(req.http.Vary, ",? *User-Agent *", "");
set beresp.http.Vary = regsub(req.http.Vary, "^, *", "");
if (beresp.http.Vary == "") {
remove beresp.http.Vary;
}
}
@KINKCreative
KINKCreative / gist:11323385
Created April 26, 2014 15:46
CreativeCommons License
<a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/4.0/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-nc-nd/4.0/88x31.png" /></a><br />This <span xmlns:dct="http://purl.org/dc/terms/" href="http://purl.org/dc/dcmitype/StillImage" rel="dct:type">work</span> by <a xmlns:cc="http://creativecommons.org/ns#" href="http://garabatos.me" property="cc:attributionName" rel="cc:attributionURL">Garabatos</a> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/4.0/">Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License</a>.
@KINKCreative
KINKCreative / gist:375836c1c69002c1f1f1
Last active August 29, 2015 14:01
Screen Unix Commands
screen command Task
Ctrl+a c Create new window
Ctrl+a k Kill the current window / session
Ctrl+a w List all windows
Ctrl+a 0-9 Go to a window numbered 0 9, use Ctrl+a w to see number
Ctrl+a Ctrl+a Toggle / switch between the current and previous window
Ctrl+a S Split terminal horizontally into regions and press Ctrl+a c to create new window there
Ctrl+a :resize Resize region
Ctrl+a :fit Fit screen size to new terminal size. You can also hit Ctrl+a F for the the same task
Ctrl+a :remove Remove / delete region. You can also hit Ctrl+a X for the same taks
@KINKCreative
KINKCreative / gist:5a79a99f07f66d90eec4
Last active August 29, 2015 14:01
Rsync between two servers
rsync -rtvz --progress --partial --exclude user@remote.server.com:/srv/www www/