Skip to content

Instantly share code, notes, and snippets.

View KyleJamesWalker's full-sized avatar
😃
Hello!

Kyle James Walker (he/him) KyleJamesWalker

😃
Hello!
View GitHub Profile
@KyleJamesWalker
KyleJamesWalker / NestedDefaultDict.py
Last active January 4, 2016 05:09
Create a default dictionary n levels deep, with support for json.dumps() without the need for a special encoder.
import json
from collections import defaultdict
class NestedDefaultDict(defaultdict):
def __init__(self, depth, default=int, _root=True):
self.root = _root
self.depth = depth
if depth > 1:
@KyleJamesWalker
KyleJamesWalker / sublimesettings.md
Last active January 4, 2016 06:39
My Sublime Settings Files

Packages

  • BlockCursorEverywhere
  • Anaconda
  • Better CoffeeScript
  • CoffeeComplete Plus (Autocompletion)
  • Git
  • GitGutter
@KyleJamesWalker
KyleJamesWalker / VagrantSSHAngentForwardingWithAnsible.md
Last active December 10, 2019 01:37
Vagrant SSH Agent Forwarding Working 1.4.3

This was working on Vagrant 1.4.3 (Mac).

#HOST#

File: ~/.ssh/config

Host vagrant.*
ForwardAgent yes

File: Vagrantfile

from flask import Blueprint
shared_value = None
class RegisteringExampleBlueprint(Blueprint):
'''
Example showing how to access a value for routes
saved in flask's configuration section for all routes in
blueprint.
'''
Quick and dirty code to see if I could figure out the next
larger number with all the same digits of the number passed.
Note: After coming up with the solution I found the following
http://stackoverflow.com/questions/9368205/given-a-number-find-the-next-higher-number-which-has-the-exact-same-set-of-digi
'''
def get_next(the_num):
the_num = str(the_num)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import logging
import logging.handlers
import requests
class BufferingSlackWebHookHandler(logging.handlers.BufferingHandler):
description "Hubot Slack bot"
# Slack-specific environment variables. Change these:
env HUBOT_SLACK_TOKEN=aaaaaaaaaaaaaaaaaaaaaaaaaa
env HUBOT_SLACK_TEAM=example
env HUBOT_SLACK_BOTNAME=flash_gordan
env HUBOT_AUTH_ADMIN=admin
# Subscribe to these upstart events
# This will make Hubot start on system boot
@KyleJamesWalker
KyleJamesWalker / Ranger.md
Last active February 4, 2020 16:03
Ranger Setup

Ranger mac setup:

  • brew install ranger
  • ranger --copy-config=all
  • vim ~/.config/ranger/rc.conf
    • preview_image false --> true

Other Tools:

  • brew install w3m
  • brew install lynx
@KyleJamesWalker
KyleJamesWalker / googleLogin.py
Last active June 7, 2017 13:49
Login to Google (browser style)
# encoding: utf-8
from __future__ import unicode_literals
import os
import requests
import sys
def get_google_auth_session(username, password):
session = requests.Session()
@KyleJamesWalker
KyleJamesWalker / dir_to_srt.py
Last active December 15, 2018 01:51
Converts a folder of srt files into a single srt
# -*- coding: utf-8 -*-
'''
Quick script to embed into Automator to concat a folder of srt files into
a single srt.
Note: This also removes extra blanks lines, to allow pycaption to process
the files. This won't be needed if https://github.com/pbs/pycaption/pull/39
is merged.
'''