Skip to content

Instantly share code, notes, and snippets.

View betawax's full-sized avatar

Holger Weis betawax

  • Germany
View GitHub Profile
@betawax
betawax / gist:5d9d1bc35de084b92596b526f624a3d9
Last active November 25, 2018 08:37
Remove all untracked and ignored files & directories with Git
git clean -xfd <path>
# foobar.rb
lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
# lib/foobar.rb
$LOAD_PATH.unshift File.dirname(__FILE__)
curl -T [FILE] ftp://[HOST] --user [USER]:[PASSWORD]
@betawax
betawax / gist:4ab5518ac1e98732b622
Created October 15, 2015 07:17
MySQL search & replace
UPDATE [TABLE] SET [FIELD] = REPLACE([FIELD], 'foo', 'bar') WHERE INSTR([FIELD], 'foo') > 0;
@betawax
betawax / gist:43158907217df9457ce7
Created August 25, 2015 06:50
Fix unknown MySQL collation & character set
:%s/utf8mb4_unicode_ci/utf8_unicode_ci/g
:%s/utf8mb4/utf8/g
@betawax
betawax / gist:96de9614afa4165a88d5
Created August 11, 2015 07:04
Shell syslog logger
logger -p local5.info "info"
logger -p local5.error "error"
logger -p local5.debug "debug"
@betawax
betawax / gist:f54c5411ad00c5e189f0
Created April 1, 2015 14:27
List all DNS records for a domain
dig @8.8.8.8 example.com any
@betawax
betawax / gist:464028a57a899a49cada
Created February 3, 2015 14:37
Redirect non SSL requests via mod_rewrite
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^(.*) https://%{HTTP_HOST}/$1 [NC,R=301,L]
@betawax
betawax / gist:6e94b3513055f9c23e1f
Created December 18, 2014 07:36
Repair a HTML string
tidy_repair_string($string, ['show-body-only' => true], 'utf8');
@betawax
betawax / gist:92a5945d00ffe8354de2
Created December 18, 2014 06:49
Get the HTTP response and request header with curl
curl -I http://example.com
curl -v -I http://example.com