Skip to content

Instantly share code, notes, and snippets.

Dennis Schneider dschneider

Block or report user

Report or block dschneider

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@dschneider
dschneider / debug.clj
Last active Aug 29, 2015 — forked from vsmart/gist:8deecda2be8fb3e6afa0
Debug clojure cool
View debug.clj
;; This is a useful macro for clojure debugging
(defmacro dbg[x] `(let [x# ~x] (println "dbg:" '~x "=" x#) x#))
;; Use it anywhere in your expression like so:
(defn factorial[n] (if (= n 0) 1 (* n (dbg (factorial (dec n))))))
;; Taken from [stackoverflow](http://stackoverflow.com/a/2352280/789070)
@dschneider
dschneider / stream_file.sh
Last active May 29, 2018
Stream file over network with netcat and pigz
View stream_file.sh
# pigz is "A parallel implementation of gzip for modern multi-processor, multi-core machines"
# See http://zlib.net/pigz/
# On the receiving machine run this:
nc -w 10 SENDING_MACHINE_IP 7878 | pigz -d | tar x
# On the sending machine run this:
tar c FILENAME_HERE | pigz | nc -l 7878
# You can compare the md5 checksum from both files after the transfer,
View keybase.md

Keybase proof

I hereby claim:

  • I am dschneider on github.
  • I am dschneider (https://keybase.io/dschneider) on keybase.
  • I have a public key whose fingerprint is FED7 7C45 B87E 8ABA D362 F678 4AE9 9923 616C 4C6E

To claim this, I am signing this object:

@dschneider
dschneider / GenerateSSLCertificate.sh
Created May 16, 2014
Generate an SSL certificate locally
View GenerateSSLCertificate.sh
openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days XXX
@dschneider
dschneider / convert_utf8_to_utf8mb4
Created May 7, 2014
How to easily convert utf8 tables to utf8mb4 in MySQL 5.5
View convert_utf8_to_utf8mb4
# For each database:
ALTER DATABASE database_name CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;
# For each table:
ALTER TABLE table_name CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
# For each column:
ALTER TABLE table_name CHANGE column_name column_name VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
# (Don’t blindly copy-paste this! The exact statement depends on the column type, maximum length, and other properties. The above line is just an example for a `VARCHAR` column.)
@dschneider
dschneider / CameraMovement.cs
Created Mar 14, 2014
Unity 2D Camera movement
View CameraMovement.cs
using UnityEngine;
using System.Collections;
public class CameraMovement : MonoBehaviour {
public float dampTime = 0.15f;
private Vector3 velocity = Vector3.zero;
private Transform target;
// Use this for initialization
View mac_osx_hack.sh
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@dschneider
dschneider / open_modified_in_vim.sh
Created Nov 5, 2013
GIT: Open modified files in VIM
View open_modified_in_vim.sh
gst | grep modified | awk '{print $3}' | xargs vim
View route53_change_cname.rb
credentials_hash = {
aws_secret_access_key: "KEY",
aws_access_key_id: "ID"
}
route53 = Fog::DNS::AWS.new(credentials_hash)
resource_record_sets = route53.list_resource_record_sets("ZONE_ID")
data = resource_record_sets.data[:body]["ResourceRecordSets"]
redis_resource_record = data.detect { |record_set| record_set["Name"] == "record_name_with_a_dot_at_the_end." }
former_cname_entry = redis_resource_record["ResourceRecords"].first
@dschneider
dschneider / kill_process_by_name.sh
Created Oct 26, 2013
Kill process by name with shell
View kill_process_by_name.sh
ps aux | grep PROCESS_NAME | grep -v grep | awk '{print $2}' | xargs kill -9
You can’t perform that action at this time.