Skip to content

Instantly share code, notes, and snippets.

View dobesv's full-sized avatar

Dobes Vandermeer dobesv

View GitHub Profile
@dobesv
dobesv / dev_signed_cert.sh
Last active March 21, 2024 07:47
Script to create (1) a local certificate authority, (2) a host certificate signed by that authority for the hostname of your choice
#!/usr/bin/env bash
#
# Usage: dev_signed_cert.sh HOSTNAME
#
# Creates a CA cert and then generates an SSL certificate signed by that CA for the
# given hostname.
#
# After running this, add the generated dev_cert_ca.cert.pem to the trusted root
# authorities in your browser / client system.
#
@dobesv
dobesv / positionSuggestions.js
Created January 5, 2018 02:59
Code to position draft-js emojis plugin popup in way that it is more likely to be on-screen
const getRelativeParent = element => {
if (!element) {
return null;
}
const position = window
.getComputedStyle(element)
.getPropertyValue('position');
if (position !== 'static') {
return element;
@dobesv
dobesv / recenter-png-files.sh
Created January 27, 2017 03:25
Re-center all the pngs in the current folder using ImageMagick
#!/usr/bin/env bash
# Re-center all the pngs in the current folder using ImageMagick
for F in *.png ; do
convert -size $(identify -format '%wx%h' $F) xc:white \( $F -trim \) -gravity center -compose copy -composite $F
done
@dobesv
dobesv / gulpfile.js
Last active June 30, 2016 06:39 — forked from anonymous/gulpfile.js
Reproduce RegularExpression condition bug with new version of node (6.2.2)
var gulp = require('gulp');
var plugins = require('gulp-load-plugins')();
var del = require('del');
var merge = require('merge-stream');
var path = require('path');
var RevAll = require('gulp-rev-all');
var runSequence = require('run-sequence');
var os = require('os');
src = [
#!/usr/bin/env bash
PROJECT_DIR=$(git rev-parse --show-toplevel)
BASE_COMMIT='upstream/develop'
OLD_ERRS=$(mktemp)
NEW_ERRS=$(mktemp)
# Clean up temp files on interrupt/exit
trap "rm -f $NEW_ERRS" EXIT SIGINT
@dobesv
dobesv / menu.py
Created June 10, 2016 06:03
Example TkInter menu using image buttons
import Tkinter as tk
import os.path
PROJECT_DIR = os.path.abspath(os.path.dirname(__file__))
def _abspath(name):
return os.path.abspath(os.path.join(PROJECT_DIR, name))
class Application(tk.Frame):
def __init__(self, master=None, background_color='#000000', background_image=None):
@dobesv
dobesv / JacksonMapper.java
Created October 29, 2015 00:59
Use jackson to map jdbi beans
package caltrac.db;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;
import org.skife.jdbi.v2.StatementContext;
import org.skife.jdbi.v2.tweak.ResultSetMapper;
// Create a new bookmark, write javascript: and paste in the next line:
// When you are on the WebEx page to fill out name and email, click the bookmarklet
(function (name, email) { var f=window.parent.frames[1], e=(function(id) { return f.document.getElementById(id) }), an = e('attendeeName'), ae = e('attendeeEmail'), but=e('mwx-btn-pmr-enter-lobby'); an.value=name; f.AttEmailOnblur(); ae.value='dvandermeer@pulsesecure.net'; but.disabled=false; })("Dobes Vandermeer", 'dvandermeer@pulsesecure.net')