Skip to content

Instantly share code, notes, and snippets.

View lucasnad27's full-sized avatar

Lucas Culbertson lucasnad27

View GitHub Profile
@lucasnad27
lucasnad27 / SDSFIE 3.0 Create Table
Last active December 10, 2015 20:18
SublimeSnippet
<snippet>
<content><![CDATA[
CREATE TABLE GCWGS84_VECTOR.${1:FeatureClassName}
(
${1:FeatureClassName}IDPK NVARCHAR2(20),
SDSID NVARCHAR2(20),
SDSFEATURENAME NVARCHAR2(80),
SDSFEATUREDESCRIPTION NCLOB,
SDSMETADATAID NVARCHAR2(80),
MEDIAIDFK NVARCHAR2(20),
@lucasnad27
lucasnad27 / line_generation.py
Last active December 11, 2015 18:39
Create genealogical lines from nodes
import urllib2
import urllib
base_url = 'http://lucasnad27.cartodb.com/api/v2/sql'
api_key = 'none of your business'
delete_sql = urllib.quote('delete from CONNECTORS')
insert_sql = urllib.quote('Insert into connectors (the_geom,person_id) select ST_MakeLine(points), c.person_id from (select n.the_geom as points, n.person_id from nodes as n order by start_date) c group by c.person_id')
req = urllib2.Request('%s/?q=%s&api_key=%s' % (base_url, delete_sql, api_key))
response = urllib2.urlopen(req)
@lucasnad27
lucasnad27 / generate_lines.py
Created March 15, 2013 13:50
Genealogy Line Work
import urllib2
import urllib
base_url = 'http://lucasnad27.cartodb.com/api/v2/sql'
api_key = 'none of your business'
delete_sql = urllib.quote('delete from CONNECTORS')
insert_sql = urllib.quote('Insert into connectors (the_geom,person_id) select ST_MakeLine(points), c.person_id from (select n.the_geom as points, n.person_id from nodes as n order by start_date) c group by c.person_id')
req = urllib2.Request('%s/?q=%s&api_key=%s' % (base_url, delete_sql, api_key))
response = urllib2.urlopen(req)
@lucasnad27
lucasnad27 / Inlets.js
Last active December 15, 2015 04:19
Blog post for marionette.js with ESRI mapping API
RPAT.module('Inlets', function(Inlets, App, Backbone, Marionette, $, _) {
// Inlet Model
// -----------
Inlets.Inlet = Backbone.Model.extend({
idAttribute: "OBJECTID",
defaults: {
@lucasnad27
lucasnad27 / beautiful_idiomatic_python.md
Last active November 27, 2022 13:39 — forked from JeffPaine/beautiful_idiomatic_python.md
Transforming Code into Beautiful, Idiomatic Python: notes from Raymond Hettinger's talk at pycon US 2013. The code examples and direct quotes are all from Raymond's talk. I've reproduced them here for my own edification and the hopes that others will find them as handy as I have!

Transforming Code into Beautiful, Idiomatic Python

Notes from Raymond Hettinger's talk at pycon US 2013 video, slides and pycon US 2015 video

The code examples and direct quotes are all from Raymond's talk. I've reproduced them here for my own edification and the hopes that others will find them as handy as I have!

Looping over a range of numbers

for i in [0, 1, 2, 3, 4, 5]:
{
"build_systems":
[
{
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"name": "Anaconda Python Builder",
"selector": "source.python",
"shell_cmd": "\"/Users/luke/.pyenv/versions/kris-kringle/bin/python\" -u \"$file\""
}
],
import csv
from pathlib import Path
def get_headers():
# total hack
with open('File1.txt') as f:
headers = []
for line in f:
if ':' not in line:
from enum import Enum
import rq
from redis import Redis
import settings
class Priority(Enum):
low = 'low'
default = 'default'
;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Configuration Layers declaration.
You should not put any user code in this function besides modifying the variable
values."
(setq-default
;; Base distribution to use. This is a layer contained in the directory
;; `+distribution'. For now available distributions are `spacemacs-base'
@lucasnad27
lucasnad27 / settings.json
Created July 26, 2021 14:35
Custom docker keybindings for VSpaceCode
{
"vspacecode.bindingOverrides": [
{
"keys": "d",
"name": "Docker...",
"type": "bindings",
"bindings": [
{
"key": "c",
"name": "Containers",