Skip to content

Instantly share code, notes, and snippets.

View rizplate's full-sized avatar

Whats in the name rizplate

View GitHub Profile
@yuvadm
yuvadm / fabfile.py
Created March 16, 2011 13:41
Fabric example for SSH keyfile connection
from fabric.api import *
env.hosts = ['host.name.com']
env.user = 'user'
env.key_filename = '/path/to/keyfile.pem'
def local_uname():
local('uname -a')
def remote_uname():
@ogrisel
ogrisel / learning_curves.png
Created December 30, 2011 16:04
Learning Curves for under/overfitting evaluation
learning_curves.png
@ibeex
ibeex / foo.log
Created August 4, 2012 13:46
Flask logging example
A warning occurred (42 apples)
An error occurred
@jasonamyers
jasonamyers / 2013-02-15-SQLAlchemy-Func-and-Group.py
Last active January 21, 2021 14:45
This is from my blog post on pyNash
from sqlalchemy import create_engine
engine = create_engine('sqlite:///:memory:', echo=True)
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
from sqlalchemy import Column, Integer, String, Float
class User(Base):
__tablename__ = 'users'
@dctrwatson
dctrwatson / nginx.conf
Last active April 28, 2024 10:26
Caching PyPi packages locally with nginx
user www-data;
worker_processes 4;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
@goldhand
goldhand / Django + Ajax dynamic forms .py
Last active September 29, 2023 06:32
Django form with Ajax. A simple Task model that can be updated using a CBV with an AJAX mixin. The view sends post data with ajax then updates the view with a callback to a DetailView with a json mixin.There is an abstract CBV, AjaxableResponseMixin, based on the example form django docs, that is subclassed in the TaskUpdateView CBV. TaskUpdateV…
#models.py
class Task(models.Model):
title = models.CharField(max_length=255)
description = models.TextField()
def __unicode__(self):
return self.title
@jasonrudolph
jasonrudolph / gist:6057563
Last active December 15, 2023 14:52
GitHub Search API: Get the number of stars for a repository

James Sugrue [asked][1], "@GitHubAPI is there a way to find the number of stars for a given repository?"

Example

$ curl -ni "https://api.github.com/search/repositories?q=more+useful+keyboard" -H 'Accept: application/vnd.github.preview'
{
@brandon-rhodes
brandon-rhodes / build-overlay.py
Last active April 26, 2024 13:44
Script that builds a Google Earth overlay that projects the map of Tolkien’s Middle-earth atop modern Europe at the correct position and scale. Once the .kmz overlay file has been generated, simple open it using the File menu in Google Earth.
"""Project a map of Middle-earth on modern Europe.
Builds an `overlay.kmz` file in the current directory which should be
opened with Google Earth.
"""
import os
import urllib2
import zipfile
from math import cos, radians
@quiver
quiver / create_dlq.py
Last active September 10, 2018 23:41
aws sqs dead letter queue sample(w/ boto)
# vim: set fileencoding=utf8
# http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/SQSDeadLetterQueue.html
# http://aws.typepad.com/aws/2014/01/amazon-sqs-new-dead-letter-queue.html
import json
import boto
from pprint import pprint
conn = boto.connect_sqs()
q1 = conn.create_queue('test_q1')
@lttlrck
lttlrck / gist:9628955
Created March 18, 2014 20:34
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote