Skip to content

Instantly share code, notes, and snippets.

@chriha
chriha / get_images.sh
Created March 4, 2014 07:53
Download all images from a websites directory
wget -A.png,.jpg,.gif,.jpeg -e robots=off -m -k -nv -np -p \ --user-agent="Mozilla/5.0 (compatible; Konqueror/3.0.0/10; Linux)" \ http://site.url/
# -A comma-separated list of accepted extensions.
# -e execute a `.wgetrc'-style command.
# -m shortcut for -N -r -l inf --no-remove-listing.
# -k make links in downloaded HTML or CSS point to local files.
# -nv turn off verboseness, without being quiet.
# -np don't ascend to the parent directory.
# -p get all images, etc. needed to display HTML page.
@chriha
chriha / split_file.sh
Created March 6, 2014 08:16
Splitting a file into multiple pieces by filesize or length.
# Split file "bigfile.sql" by SIZE
split -b 10[k|m] bigfile.sql bigfile.spl.
# or LENGTH
split -l 10 bigfile.sql bigfile.spl.
# bigfile.spl.aa
# bigfile.spl.ab
# bigfile.spl.ac
@chriha
chriha / address_validation.html
Created March 6, 2014 10:23
Validates an address with Google's Geocoding API
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>Google Maps JavaScript API v3 Example: Map Simple</title>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
var geocoder, map, marker;
@chriha
chriha / .gitignore
Last active August 29, 2015 13:57
Default .gitignore
# Compiled source
# ---------------------------
*.com
*.class
*.dll
*.exe
*.o
*.so
*.map
@chriha
chriha / change_osx_screenshot_dir.sh
Created March 17, 2014 13:39
Changing the location of created screenshots with OS X
defaults write com.apple.screencapture location /Users/USER/Bilder/Screenshots
killall SystemUIServer
@chriha
chriha / create_bootable_usb.sh
Created March 24, 2014 23:10
Create a bootable USB stick on OS X
# Convert .iso to .img. OS X will create a ".img.dmg", don't rename it
hdiutil convert -format UDRW -o ~/path/to/target.img ~/path/to/os.iso
# Remove your USB device and run
diskutil list
# Insert USB device and run diskutil again
diskutil list
# Determine the device node assigned to your flash media (e.g. /dev/disk2)
@chriha
chriha / Vagrantfile
Last active August 29, 2015 13:58
Default vagrant file
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "chef/debian-7.6"
config.vm.network :private_network, ip: "192.168.222.222"
# config.vm.synced_folder ".", "/var/www", owner: "www-data", group: "www-data"
@chriha
chriha / jquery.plugin.js
Created June 5, 2014 20:00
Example for creating a jQuery plugin.
/*!
* jQuery pluginName
* Original author: Chris Hartmann @chriha
*
* Calling the plugin:
*
* $( '#element-id' ).pluginName( { value1: false } );
*
*/
@chriha
chriha / copy_theme.php
Created January 13, 2015 11:56
OXID: copy DB settings from one theme to another.
<?php
/**
* for shop versions 4.7.x / 5.0.x
* # copy the source-themefolders in application/views/tpl and /out and rename
* # Adjust values for Source and Target below
* # Put file into rootlevel
* # run this script
* # delete this file after usage
*/
@chriha
chriha / iso.php
Created March 23, 2015 11:27
Functions to identify ISO alpha-2 code and to check if country is a european country or in european union
<?php
/**
* Returns the ISO alpha-2 code of a country
*
* @param string $country The country to search for
* @return string
*/
function iso_by_country( $country )
{