Skip to content

Instantly share code, notes, and snippets.

View katylava's full-sized avatar
🐢

katy lavallee katylava

🐢
View GitHub Profile
@tstachl
tstachl / google_apps_post_request.js
Created September 12, 2013 17:13
Creating a new desk.com email case using Basic Auth from Google Apps Script.
var url = "https://yoursitename.desk.com/api/v2/cases";
var options = {
"method": "post",
"headers": {
"Authorization": "Basic " + Utilities.base64Encode("you@example.com:yourpassword")
},
"payload": {
"type": "email",
"subject": "Email Case Subject",
"priority": 4,
@jiaaro
jiaaro / script.bash
Created April 24, 2013 14:45
Embed Python in a bash script
#!/bin/bash
export FOO=100
python - <<END
import os
print "foo:", os.environ['FOO']
END
@katylava
katylava / spndrinking.md
Last active October 7, 2015 12:48
Supernatural Drinking Game

Supernatural Drinking Game

BEWARE SPOILERS
This is for people re-watching the series.


Drink when:

@ttscoff
ttscoff / editscript.rb
Created July 7, 2012 01:26
Fuzzy CLI file search through configured directories, ranked results displayed as menu
#!/usr/bin/env ruby
# encoding: utf-8
# == Synopsis
# Proof of concept using Fuzzy File Finder to locate a script to edit
# Searches a set of predefined locations for a fuzzy string
# e.g. "mwp" matches both "myweatherprogram" and "mowthelawnplease"
# ................on "(m)y(w)eather(p)rogram" and "(m)o(w)thelawn(p)lease"
#
# Results are ranked and a menu is displayed with the most likely
# match at the top. Editor to be launched and directories to search
@ojii
ojii / chainable_manager.py
Created July 3, 2012 13:24
Django Model Managers
from django.db import models
class ChainableManager(models.Manager):
"""
A manager that allows chaining of all methods defined on it.
Example:
class MyManager(ChainableManager):
def active(self):
@zacharyvoase
zacharyvoase / smartslice.py
Created June 11, 2012 22:36
A smarter Python `slice` object.
class SmartSlice(object):
"""
A slice object which represents the mapping between old and new indices.
Given a slice object, you can determine whether a given index will be
present in the sub-list that slice represents. For example:
>>> 3 in SmartSlice(2, 5)
True
@kennethreitz
kennethreitz / flaskapp.py
Created June 9, 2012 15:38
My typical flask app base
# -*- coding: utf-8 -*-
import os
from flask import Flask
from flask_heroku import Heroku
from flask_sslify import SSLify
from raven.contrib.flask import Sentry
from flask.ext.celery import Celery
@ahoward
ahoward / caching-https-creds.markdown
Created June 6, 2012 21:42
Fix Username/Password prompting for github repos cloned via https scheme

github recently switched to an https scheme as the default for cloning repos. as a side effect you may suddenly be prompted for a 'Username' and 'Password' when you push where, previously, you were able to do so without typing in credentials. the solution is to cause git to cache https credentials which is easy, since git uses curl under the covers

in your home directory create a file called '.netrc', for example

/Users/ahoward/.netrc

in it put these contents

@trey
trey / ssh_keys_osx.md
Created May 18, 2012 03:22
Using SSH Keys for Password-Free Logins From OS X

Probably not the best way to do things these days.


If your remote username is different from your OS X username, edit your ~/.ssh/config file like so:

Host whathaveyou.com
    User remote_username

Generating your keys

@trey
trey / happy_git_on_osx.md
Last active February 18, 2024 10:46
Creating a Happy Git Environment on OS X

Creating a Happy Git Environment on OS X

Step 1: Install Git

brew install git bash-completion

Configure things:

git config --global user.name "Your Name"

git config --global user.email "you@example.com"