Skip to content

Instantly share code, notes, and snippets.

@sanchezg
sanchezg / download_and_pickle_stories.py
Created October 22, 2015 12:46 — forked from glarrain/download_and_pickle_stories.py
Exporting data from Pivotal Tracker is a pain in the ass. The following scripts let you download all the stories of a given project, and then (optionally) extract all the attachments linked to those, and download them
"""Download stories of a Pivotal Tracker project.
You need the project ID (an int) and your API token. The latter can be
obtained in ``https://www.pivotaltracker.com/profile``, or using curl::
$ curl -u username:password -X GET https://www.pivotaltracker.com/services/v3/tokens/active
"""
import getpass
import pickle
/* Merge sort in C */
#include<stdio.h>
#include<stdlib.h>
// Function to Merge Arrays L and R into A.
// lefCount = number of elements in L
// rightCount = number of elements in R.
void Merge(int *A,int *L,int leftCount,int *R,int rightCount) {
int i,j,k;
import numpy as np
class DirectTransformer:
"""Utility for building class-like features from a single-point function, but that may need
some general configuration first (you usually override __init__ for that)
"""
def fit(self, X, y=None):
return self
import numpy as np
class OneHotTransformer:
def __init__(self, func):
self.f = func
def fit(self, X, y=None):
unseen = object()
seen = set()
for x in X:
from sklearn.feature_extraction.text import CountVectorizer
class ProjectionCountVectorizer(CountVectorizer):
def __init__(self, projection_path, *args, **kwargs):
self.projection_path = projection_path.split('/')
super().__init__(*args, **kwargs)
def build_preprocessor(self):
built = super().build_preprocessor()
@sanchezg
sanchezg / bash-history-to-zsh-history.py
Created December 20, 2016 23:51 — forked from op/bash-history-to-zsh-history.py
Bash history to Zsh history
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This is how I used it:
# $ cat ~/.bash_history | bash-history-to-zsh-history >> ~/.zsh_history
import sys
def main():
@sanchezg
sanchezg / README.md
Created May 8, 2018 21:45 — forked from jacobsvante/README.md
My version of the Agnoster theme, with Virtualenv support

agnoster.zsh-theme

A ZSH theme optimized for people who use:

  • Solarized
  • Git
  • Unicode-compatible fonts and terminals (I use iTerm2 + Menlo)

For Mac users, I highly recommend iTerm 2 + Solarized Dark

@sanchezg
sanchezg / deploy-django.md
Last active May 25, 2022 19:54 — forked from rmiyazaki6499/deploy-django.md
Deploying a Production ready Django app on AWS

Deploying a Production ready Django app on AWS

In this tutorial, I will be going over to how to deploy a Django app from start to finish using AWS and EC2. Recently, my partner Tu and I launched our app Hygge Homes (a vacation home rental app for searching and booking vacation homes based off Airbnb) and we wanted to share with other developers some of the lessons we learned along the way.

Following this tutorial, you will have an application that has:

  • An AWS EC2 server configured to host your application
  • SSL-certification with Certbot
  • A custom domain name
  • Continuous deployment with Github Actions/SSM Agent