Skip to content

Instantly share code, notes, and snippets.

View lanmaster53's full-sized avatar

Tim Tomes lanmaster53

View GitHub Profile
@lanmaster53
lanmaster53 / tag-replace.js
Last active May 5, 2017 13:55
JavaScript library for parsing template tags out of textarea elements and overlaying a select element of options with which to replace the tag.
// define global variables to pass data between textarea and select elements
var currentEl = null;
var currentTag = null;
// dynamically create a select box to populate with options
$("body").append($("<select></select>").attr("id", "template-select").attr("style", "position: absolute; display: none;"))
function getCaretPosition(el) {
var start, end;
if (el.setSelectionRange) {
<!DOCTYPE HTML>
<html>
<head>
<title>Arrow</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
.arrow-1 {
content: "";
# other stuff here
# derivative of https://github.com/lojikil/dotfiles/blob/master/.bashrc#L33
# create virtualenv management functions
function venv-activate() {
# always activate a local venv if available
if [ -d "$(pwd)/venv" ]
then
echo "local virtualenv activated (venv)."
# ...but warn if a global venv by the given name exists
def is_safe_url(url, origin):
# url: "next" parameter value
# origin: full request URL
host = urlparse(origin).netloc
proto = urlparse(origin).scheme
# reject blank urls
if not url:
return False
url = url.strip()
url = url.replace('\\', '/')
@lanmaster53
lanmaster53 / diff.py
Last active September 18, 2015 09:33
#!/usr/bin/env python
import argparse
import ctypes
import difflib
import itertools
import os
import sys
# ingore hidden directories
import argparse
import datetime
import urllib
import urllib2
import json
import sys
_token = 'YOUR_SLACK_API_KEY'
_files_list_url = 'https://slack.com/api/files.list'
_files_delete_url = 'https://slack.com/api/files.delete'

Keybase proof

I hereby claim:

  • I am lanmaster53 on github.
  • I am lanmaster53 (https://keybase.io/lanmaster53) on keybase.
  • I have a public key whose fingerprint is B279 E8C6 4E81 365C D7B2 B26B B949 6C76 7931 0988

To claim this, I am signing this object:

@lanmaster53
lanmaster53 / parsemail.py
Last active March 17, 2020 08:12
Email Attachment Parser
#!/usr/bin/env python
import sys
import email
raw = open(sys.argv[1]).read()
msg = email.message_from_string(raw)
print 'Parsing message...'
for part in msg.walk():
c_disp = part.get('Content-Disposition')