Skip to content

Instantly share code, notes, and snippets.

View finferflu's full-sized avatar
🏠
Working from home

Emmanuele finferflu

🏠
Working from home
  • Manchester, UK
View GitHub Profile
@el22or
el22or / mysql-export-import
Last active September 28, 2022 12:04
Remote MySQL database dump directly into local database
## SSH - Remote export > local import
ssh USER@HOST mysqldump -uREMOTEDATABASEUSER -pREMOTEDATABASEPASSWORD -hREMOTEHOST REMOTEDATABASENAME | mysql -uLOCALDATABASEUSER -pLOCALDATABASEPASSWORD LOCALDATABASENAME
## Export to CSV
mysql -uUSER -pPASS DATABASENAME -B -e "select * from \`korisnici\`;" | sed 's/\t/","/g;s/^/"/;s/$/"/;s/\n//g' > filename.csv
## Export to CSV 2
mysql -uUSER -pPASS DATABASE -B -e "SELECT users.uid AS 'ID', users.name AS 'Username', users.mail AS 'Email', from_unixtime(users.created) AS 'Created', from_unixtime(users.login) AS 'Last login' FROM users WHERE users.status=1 AND users.login!=0 ORDER BY users.login DESC;" | sed "s/'/\'/;s/\t/\",\"/g;s/^/\"/;s/$/\"/;s/\n//g" > vehicle_categories.csv
## Export to SQL gzipped file with compression
@lavoiesl
lavoiesl / duplicity-backup.sh
Created May 3, 2012 00:44
Very low priority backup using duplicity
#!/bin/bash
# Export some ENV variables so you don’t have to type anything
export AWS_ACCESS_KEY_ID='my-key-id'
export AWS_SECRET_ACCESS_KEY='my-secret'
export PASSPHRASE='my-gpg-key-passphrase'
GPG_KEY='my-gpg-pub-id'
# The source of your backup
SOURCE=/
@benatkin
benatkin / Global.sublime-settings
Created July 20, 2011 04:26
excluding node_modules from Sublime Text 2
// Place user-specific overrides in this file, to ensure they're preserved
// when upgrading
{
"folder_exclude_patterns": [".svn", ".git", ".hg", "CVS", "node_modules"]
}
@brendo
brendo / EventTutorial.md
Created April 4, 2011 11:06
Symphony Events: A Detailed Look

Forms have been an integral part of any interactive site since the dawn of time, they promote interactivity and are usually the most common way users interact with a site. It's commonplace that when a form is submitted, the website will take 'action' and do something with the data and then provide a user with the result. Symphony provides this logic layer via Events.

This tutorial assumes you have a basic understanding of how Events work in Symphony (if not, this may be a good introduction) and are semi comfortable writing some PHP code. I'll be showing you some of the lesser known features of Symphony Events, including event priority, event chaining and a brief demonstration of how to write a custom Event. The difficulty level progresses as we go through, but with any luck you'll be able to learn a thing or two :)

Getting Started

The Scenario

Our client requires a form that allows a user to submit some details about their new car purchase. Th

#!/bin/bash
# SPDX-License-Identifier: MIT
## Copyright (C) 2009 Przemyslaw Pawelczyk <przemoc@gmail.com>
##
## This script is licensed under the terms of the MIT license.
## https://opensource.org/licenses/MIT
#
# Lockable script boilerplate