Skip to content

Instantly share code, notes, and snippets.

from PIL import Image
original_11 = "1024.png"
original_43 = "1024x768.png"
im = Image.open(original_11)
variants_11 = [
58,
87,
-- Source:https://github.com/owenlo/Marble-Hammerspoon
-- Source:https://github.com/tekezo/Karabiner/issues/814#issuecomment-415388742
-- HANDLE SCROLLING WITH MOUSE BUTTON PRESSED
local backMouseButton = 3
local forwardMouseButton = 4
local deferred = false
local VSCODE = 'Code'
local VIM = 'MacVim'
@keewon
keewon / test.rb
Created February 4, 2015 08:42
Convert Markdown slim to HTML
# Do 'gem install redcarpet'
# Usage:
# ruby test.rb > test.html
#
require 'slim'
s = File::open('markdown.html.slim').read()
# Requires Python 2.x, flask and pywin32
from flask import Flask
import flask
import win32com.client
import pythoncom
import os, os.path, sys, time
# Flask (Web Server)
ws = Flask(__name__)
#!/usr/bin/env python
# Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@keewon
keewon / pubchem_2d_structure_json_to_svg.py
Last active June 21, 2017 17:07
Pubchem 2D structure json to SVG
import os, sys, json, math
svg_width = 512
svg_height = 512
margin_x = svg_width / 10.0
margin_y = svg_height / 10.0
font_size = 16
charge_stroke_width=2.0
@keewon
keewon / fix_tapjoy_v2_dashboard_date_range_bug.js
Last active June 15, 2017 05:23
fix Tapjoy v2 dashboard date range bug
/* https://dashboard.tapjoy.com/dashboard/v2/advertise/list?start=2017-05-23&end=2017-05-27&granularity=1.day&range=custom */
/* use this site to create bookmarklet - http://mrcoles.com/bookmarklet/ */
require.s.contexts._.defined['lib/models/ad_filter'].prototype.computeDates = function(range) {
var dateFormat, endDate, endDateString, isOneDayHourly, number_and_word_range, startDate, startDateString, timezone;
if (range == null) {
range = null
}
range || (range = this.get("range"));
number_and_word_range = /^(\d+)(\w+)$/.exec(range);
import os
from datetime import datetime
# Downloaded files from Google Photo have time in UTC.
# I want to change them to use my local timezone.
tzdiff = 3600 * 9 # my timezone is +09:00
for f in os.listdir('.'):
if '.JPG' in f or '.jpg' in f:
stinfo = os.stat(f)