Skip to content

Instantly share code, notes, and snippets.

View ain's full-sized avatar

Ain Tohvri ain

View GitHub Profile
@ain
ain / git-info
Created February 6, 2013 16:00
Shell script that displays repository information for Git.
#!/bin/bash
# author: Duane Johnson
# email: duane.johnson@gmail.com
# date: 2008 Jun 12
# license: MIT
#
# Based on discussion at http://kerneltrap.org/mailarchive/git/2007/11/12/406496
pushd . >/dev/null
@ain
ain / mysqldumpgz
Last active December 16, 2015 02:28
mysqldump a database to gzip
#!/bin/bash
usage="Usage: mysqldumpgz database_name username"
err[1]="Invalid command"
# Check for database name argument
if [ -z "$1" ]
then
echo ${err[1]}
@ain
ain / mysql_collation_to_utf8
Last active December 17, 2015 02:59
Convert MySQL collation of all fields in database to UTF-8 at once
#!/bin/bash
usage="Usage: mysql_collation_to_utf8 database_name username"
err[1]="Invalid command"
# Check for database name argument
if [ -z "$1" ]
then
echo ${err[1]}
@ain
ain / mysql_csv_dump
Created May 16, 2013 14:10
MySQL select query dump to CSV
#!/bin/bash
usage="Usage: mysql_csv_dump database_name username"
err[1]="Invalid command"
# Check for database name argument
if [ -z "$1" ]
then
echo ${err[1]}
@ain
ain / netbeans_ignore.regex
Last active December 18, 2015 11:18
Regex for Netbeans' Ignored Files Pattern to make Travis CI dotfile visible
^(CVS|SCCS|vssver.?\.scc|#.*#|%.*%|_svn)$|~$|^\.(?!htaccess|jshintrc|DS_Store|gitattributes|gitignore$|.*\.yml$).*$
@ain
ain / poster.php
Created August 23, 2013 15:34
PHP dummy parsing the REQUEST.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
</head>
<body>
<pre><?php print_r($_REQUEST); ?></pre>
</body>
</html>
@ain
ain / Keyboard-et.plist.part
Last active December 26, 2015 15:08
Mapping for PressAndHold.app for selecting special characters on press and hold Q key on Mac.
<key>Roman-Accent-Q</key>
<dict>
<key>Direction</key>
<string>right</string>
<key>Keycaps</key>
<string>` ^ ° • ★ “ ”</string>
<key>Strings</key>
<string>` ^ ° • ★ “ ”</string>
</dict>
@ain
ain / email-regex.js
Last active December 28, 2015 23:19
Email validation regex for emails likely to be used in Germany.
var emailRegex = /^([\wäöüÜÖÄß])+(([\.]{0,1}[\wäöüÜÖÄß])?)*(([\+]{0,1}[\wäöüÜÖÄß])?)*([\wäöüÜÖÄß-])*\@([\wäöüÜÖÄß-]+\.)+([\w]{2,})+$/;
@ain
ain / release-cleanup.sh
Created December 5, 2013 15:18
Release folder cleanup script for Capistrano-like folder structure
#!/bin/bash
KEPT_RELEASES=5
CWD=/Users/ain/temp
# Check for Bash config
# On FreeBSD/OS X GNU ls is required for -v option
if [ -f ~/.bashrc ]; then
shopt -s expand_aliases
source ~/.bashrc
@ain
ain / wp-importer.rb
Created July 17, 2016 22:44
Wordpress data Import script for Jekyll 3
require "jekyll-import"
JekyllImport::Importers::WordpressDotCom.run({
"source" => "wp-export.xml"
})