Skip to content

Instantly share code, notes, and snippets.

View jpoehnelt's full-sized avatar
🏠
Working from home

Justin Poehnelt jpoehnelt

🏠
Working from home
View GitHub Profile
@jpoehnelt
jpoehnelt / gist:59060bcf3cac03eff518
Created June 4, 2014 18:33
Excel VBA: Insert Image into Comment
Sub InsertPictures()
' Variable Declarations
Dim cll As Range
Dim rng As Range
Dim strPath As String
' Path to photos
strPath = "D:\Photo Folder"
' Set the range
@jpoehnelt
jpoehnelt / hash by start by alphabet
Created June 9, 2014 07:04
hash by start by alphabet
from os import listdir
from os.path import isfile, join
import shutil
def moveDirectory(src, dest):
try:
shutil.move(src, dest)
# Directories are the same
except shutil.Error as e:
print('Directory not copied. Error: %s' % e)
@jpoehnelt
jpoehnelt / sub
Created June 10, 2014 05:35
Insert image into actively selected cell's comment and remove previously selected cell's comment in a range.
Public OldCell As Range
Private Sub Worksheet_SelectionChange(ByVal Selected As Range)
' Exit if more than one cell selected
If Selected.Cells.Count > 1 Then Exit Sub
' Variable Declarations
Dim column As Range
Dim path As String
' Path to photos
@jpoehnelt
jpoehnelt / Angular Blur Directive
Created November 25, 2014 00:37
For blurring angular ng-click elements on click.
app.directive('blur', [function () {
return {
restrict: 'A',
link: function (scope, element) {
element.on('click', function () {
element.blur();
});
}
};
}]);
// in invite.js module:
exports.inviteUser = function(creatingUser,email,tempPass,response)
{
"use strict";
if (!tempPass) {
tempPass = genRandomPass();
}
var user = new Parse.User();
user.set ("username", email);
@jpoehnelt
jpoehnelt / .sql
Created March 1, 2016 00:35
Postgres Array Bounds
CREATE OR REPLACE FUNCTION array_bounds(actual integer[], upper integer[], lower integer[]) RETURNS boolean
AS $$
DECLARE
length integer;
BEGIN
IF actual is NULL THEN
RETURN FALSE;
END IF;
SELECT array_length(actual, 1) into length;
@jpoehnelt
jpoehnelt / cloudfront_nginx_fix.conf
Created May 7, 2016 18:27
Fix for Cloudfront Proxy NGINX
# Look for client IP in the X-Forwarded-For header
real_ip_header X-Forwarded-For;
# Ignore trusted IPs
real_ip_recursive on;
# Set VPC subnet as trusted
set_real_ip_from 10.0.0.0/16;
# Set CloudFront subnets as trusted
@jpoehnelt
jpoehnelt / main.py
Created July 28, 2016 22:39
tif color table to colormap
color_table = """
0: 0,0,0,255
1: 0,0,0,255
2: 0,0,0,255
3: 0,0,0,255
4: 0,0,0,255
5: 0,0,0,255
6: 0,0,0,255
7: 0,0,0,255
8: 0,0,0,255
docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)
@jpoehnelt
jpoehnelt / .sh
Created March 20, 2017 15:21
rsync google cloud compute
gcloud compute config-ssh --project myproject
rsync -avz -e ssh . vm_name.zone.myproject:/home/user/folder