Skip to content

Instantly share code, notes, and snippets.

View schie's full-sized avatar
:octocat:
doing stuff

Dustin Schie schie

:octocat:
doing stuff
View GitHub Profile
@ericchen
ericchen / gist:3081970
Created July 10, 2012 08:11
nodejs AES encrypt and decrypt
var crypto = require('crypto');
var AESCrypt = {};
AESCrypt.decrypt = function(cryptkey, iv, encryptdata) {
encryptdata = new Buffer(encryptdata, 'base64').toString('binary');
var decipher = crypto.createDecipheriv('aes-256-cbc', cryptkey, iv),
decoded = decipher.update(encryptdata);
@ericremoreynolds
ericremoreynolds / client.html
Last active February 25, 2024 21:55
Flask-socket.io emit to specific clients
<html>
<body>
<h1>I feel lonely</h1>
<script type="text/javascript" src="//code.jquery.com/jquery-2.1.3.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/socket.io/0.9.16/socket.io.min.js"></script>
<script type="text/javascript" charset="utf-8">
var socket = io.connect('http://' + document.domain + ':' + location.port);
socket.on('connect', function() {
socket.emit('connected');
@wenzhixin
wenzhixin / ubuntu14.04-command-line-install-android-sdk
Last active July 4, 2024 05:29
Ubuntu 14.04 command line install android sdk
# install openjdk
sudo apt-get install openjdk-7-jdk
# download android sdk
wget http://dl.google.com/android/android-sdk_r24.2-linux.tgz
tar -xvf android-sdk_r24.2-linux.tgz
cd android-sdk-linux/tools
# install all sdk packages
@mattantonelli
mattantonelli / numeric_regex.rb
Last active May 31, 2024 14:16
Regular expressions for numeric strings. #regex
# ALL THESE REQUIRE THE WHOLE STRING TO BE A NUMBER
#### NUMBERS AND DECIMALS ONLY ####
# No commas allowed
# Pass: (1000.0), (001), (.001)
# Fail: (1,000.0)
^\d*\.?\d+$
# No commas allowed
# Can't start with "."
@shark0der
shark0der / ubuntu14.04-command-line-install-android-sdk
Last active March 7, 2021 15:09 — forked from wenzhixin/ubuntu14.04-command-line-install-android-sdk
Ubuntu 14.04 command line install android sdk (platform & platform-tools only, no emulator)
# install java
apt-get install -y software-properties-common
apt-add-repository -y ppa:webupd8team/java
apt-get update
apt-get install -y oracle-java8-installer
# download latest android sdk
# http://developer.android.com/sdk/index.html#Other
cd /opt
wget http://dl.google.com/android/android-sdk_r24.4.1-linux.tgz
@mattantonelli
mattantonelli / copy_backups.sh
Last active November 30, 2021 13:58
Copies backups from automysqlbackup to a remote host. Retains 1 weekly and 7 daily backups per database.
#!/usr/bin/env bash
#
# Purpose:
# Maintains 7 daily and 1 weekly database backups on a remote server.
#
# Configuration:
# Subdirectories must be created on the remote server for each database.
# (This includes status & fullschema directories if applicable.)
#
# Examples:
@mattantonelli
mattantonelli / breakdown_repos.rb
Created March 4, 2016 19:16
Identifies the owners of all of a Github organization's private repos based on initial commits.
#!/usr/bin/env ruby
# encoding: utf-8
#
# Usage: ruby breakdown_repos.rb > repos.csv
#
require 'github_api'
BASIC_AUTH = 'username:personalaccesstoken'
ORG = 'myOrg'
@bastman
bastman / docker-cleanup-resources.md
Created March 31, 2016 05:55
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@mattantonelli
mattantonelli / ng-resource-boolean-response.js
Last active May 19, 2016 15:27
Transform ng-resource response that just returns a boolean
.factory('ForgotUsername', function($resource, API_BASE) {
return $resource(API_BASE + 'forgetUserID', {}, {
get: {
method: 'GET',
transformResponse: function(data, headers) {
return { Result: data === true };
}
}
});
})
@mattantonelli
mattantonelli / good_commit_messages.md
Last active May 31, 2024 14:20
A Guide to Good Commit Messages

Good Commit Messages

A good commit message helps both you and your collaborators better understand your code. A series of good messages will create a well-documented history as your code evolves. This also makes it easier for someone to pick up where you left off.

Jump to:

  1. Summary
  2. Description
  3. Full message
  4. Branch