Skip to content

Instantly share code, notes, and snippets.

@vkurup
vkurup / config.yml
Last active January 29, 2024 16:06
Config file for mac-dev-playbook
---
# Config file to override default-config.yml from git@github.com:geerlingguy/mac-dev-playbook.git
configure_dotfiles: false
configure_terminal: false
configure_osx: false
homebrew_installed_packages:
- aspell
- autoconf
- awscli
@vkurup
vkurup / init.el
Created October 24, 2012 21:18
Emacs for Python Programming setup
(require 'package)
(add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/"))
(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/"))
(package-initialize)
(when (not package-archive-contents)
(package-refresh-contents))
(defvar my-packages '(starter-kit
starter-kit-bindings
@vkurup
vkurup / generate_factories.py
Last active April 16, 2021 20:03 — forked from tobiasmcnulty/generate_factories.py
Django management command to generate factory-boy boilerplate factory definitions for all the models in a given app. The code is not intended to be usable right off the bat, it just provides a few sane defaults based on the structure of your models.
from django.core.management.base import BaseCommand
from django.db.models import get_models, get_app, fields
from django.db.models.fields import related
class Command(BaseCommand):
help = """Generate factory-boy factories for the given app"""
def handle(self, *args, **options):
assert len(args) == 1, 'Must specify app name as first and only argument'
@vkurup
vkurup / failure.json
Last active October 14, 2017 01:36
Failed run
TASK [tequila-django : upload github key] ******************************************************************************************************************************************************************
task path: /home/vkurup/dev/epicallieshq/deployment/roles/tequila-django/tasks/main.yml:74
ok: [staging] => {
"changed": false,
"checksum": "838396e7a90480edfd99021278843b6b2ee9d0cf",
"diff": {
"after": {
"path": "/home/epicallieshq/.ssh/github"
},
"before": {
@vkurup
vkurup / success.json
Created October 14, 2017 01:35
Successful run
TASK [tequila-django : upload github key] ******************************************************************************************************************************************************************
task path: /home/vkurup/dev/epicallieshq/deployment/roles/tequila-django/tasks/main.yml:74
changed: [staging] => {
"changed": true,
"checksum": "838396e7a90480edfd99021278843b6b2ee9d0cf",
"dest": "/home/epicallieshq/.ssh/github",
"diff": [],
"failed": false,
"gid": 1014,
"group": "epicallieshq",
@vkurup
vkurup / get_speed.py
Created February 2, 2017 02:40
Showing how to get arbitrary nodes in XML
(tcx)vinod@cartman:~/dev/python-tcxparser(master) $ python
Python 2.7.10 (default, Oct 14 2015, 16:09:02)
[GCC 5.2.1 20151010] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import tcxparser
>>> tcx = tcxparser.TCXParser('test.tcx')
>>> tcx.root
<Element {http://www.garmin.com/xmlschemas/TrainingCenterDatabase/v2}TrainingCenterDatabase at 0x7f97eb2689e0>
>>> namespace = 'http://www.garmin.com/xmlschemas/TrainingCenterDatabase/v2'
>>> tcx.root.findall('.//ns:Extensions', namespaces={'ns': namespace})
import urllib
import boto3
import requests
print('Loading function')
s3 = boto3.client('s3')
# someday i will need to learn how to use AWS
s3_resource = boto3.resource('s3')
@vkurup
vkurup / gist:6813749
Created October 3, 2013 17:33
vumi setup
smpp_transport:
transport_name: "transport"
system_id: smppclient1 # username
password: password # password
host: localhost # the host to connect to
port: 2775 # the port to connect to
rapidsms_relay_fake:
transport_name: 'transport'
rapidsms_url: {{ pillar['vumi']['rapidsms_url'] }}
@vkurup
vkurup / pycheckers.sh
Created October 24, 2012 21:22
Pycheckers
#!/bin/bash
pyflakes "$1"
pep8 --repeat "$1"
true
@vkurup
vkurup / glue-quote.sh
Created November 23, 2011 20:43
Take formatted commodity output from ledger and feed it to getquote
#!/bin/bash
# Reads from STDIN looking for ledger-formatted commodity symbols. Uses
# getquote (Perl script) to lookup the lastest price for commodity, then
# appends to PRICEDB file.
#
# Usage:
# ledger -n bal ^Assets:Investments | glue-quote.sh
#
# Assumes that you have 'getquote' on your path