Skip to content

Instantly share code, notes, and snippets.

View kevin1's full-sized avatar

Kevin Chen kevin1

View GitHub Profile
@steventroughtonsmith
steventroughtonsmith / Foundation.py
Last active November 15, 2023 23:48
UIKit+UIFoundation & Foundation for Pythonista - autoconverted from SDK tbd (includes non-public SPI)
# coding: utf-8
from objc_util import *
NSAKDeserializer = ObjCClass('NSAKDeserializer')
NSAKDeserializerStream = ObjCClass('NSAKDeserializerStream')
NSAKSerializer = ObjCClass('NSAKSerializer')
NSAKSerializerStream = ObjCClass('NSAKSerializerStream')
NSAbstractLayoutGuide = ObjCClass('NSAbstractLayoutGuide')
NSAddressCheckingResult = ObjCClass('NSAddressCheckingResult')
NSAffineTransform = ObjCClass('NSAffineTransform')
@skoji
skoji / remove-slack-settings.sh
Created November 2, 2015 03:34
remove Slack settings (OS X)
rm -rf ~/Library/Application\ Support/Slack/
rm -rf ~/Library/Containers/com.tinyspeck.slackmacgap/
rm -rf ~/Library/Preferences/com.tinyspeck.slackmacgap.plist
rm -rf ~/Library/Saved\ Application\ State/com.tinyspeck.slackmacgap.savedState
rm ~/Library/Safari/LocalStorage/*slack*
// This will open up a prompt for text to send to a console session on digital ocean
// Useful for long passwords
(function () {
var t = prompt("Enter text to be sent to console, (This wont send the enter keystroke)").split("");
function f() {
var character = t.shift();
var i=[];
var code = character.charCodeAt();
var needs_shift = "!@#$%^&*()_+{}:\"<>?~|".indexOf(character) !== -1
@rhossi
rhossi / s3upload.js
Created July 30, 2015 18:22
Uploading files to S3 validating ContentMD5 using AWS SDK for Node.js
var aws = require('aws-sdk'),
fs = require('fs'),
crypt = require("crypto");
function getMD5HashFromFile(file){
var hash = crypt.createHash("md5")
.update(file)
.digest("base64");
return hash;
}
@jgatjens
jgatjens / direcory_tag.rb
Created February 10, 2014 22:03
jekyll-plugin loop_directory
#usage:
#{% loop_directory directory:images iterator:image filter:*.jpg sort:descending %}
# <img src="{{ image }}" />
#{% endloop_directory %}
module Jekyll
class LoopDirectoryTag < Liquid::Block
include Liquid::StandardFilters
Syntax = /(#{Liquid::QuotedFragment}+)?/
@lisamelton
lisamelton / transcode-video.sh
Last active September 8, 2023 23:51
Transcode video file (works best with Blu-ray or DVD rip) into MP4 (or optionally Matroska) format, with configuration and at bitrate similar to popular online downloads.
#!/bin/bash
#
# transcode-video.sh
#
# Copyright (c) 2013-2015 Don Melton
#
about() {
cat <<EOF
$program 5.13 of April 8, 2015
@rxin
rxin / ramdisk.sh
Last active December 13, 2023 02:40
ramdisk create/delete on Mac OS X.
#!/bin/bash
# From http://tech.serbinn.net/2010/shell-script-to-create-ramdisk-on-mac-os-x/
#
ARGS=2
E_BADARGS=99
if [ $# -ne $ARGS ] # correct number of arguments to the script;
then
@kevcjones-archived
kevcjones-archived / howto-unlock-pdf
Last active June 20, 2022 02:19
Unlocking a PDF using ghostscript
required - install ghost script - e.g brew install ghostscript (takes a few minutes)
update this line as needed and run in terminal
-- New and updated thanks to comments --
gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -SPDFPassword=THE_PASSWORD -sOutputFile=unencrypted.pdf -c .setpdfwrite -f 2017-06-13-11-55-56-188_14972345156188_XXXPT6345X_ITRV.pdf
-- Original --
gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=unencrypted.pdf -c .setpdfwrite -f encrypted.pdf
@slinkp
slinkp / iphone_notes_converter.py
Created March 29, 2012 16:25
iPhone Notes extractor
"""
This takes the sqlite 'notes' database from an iphone and dumps it to
flat text files in the current directory, preserving modification
times.
Uses 'lynx' (separate program) to dump html to plain text.
"""
import sqlite3
import datetime