Skip to content

Instantly share code, notes, and snippets.

View niklio's full-sized avatar

Nik Liolios niklio

  • Instagram
  • New York
View GitHub Profile
function git(){
if [ "$1" == "commit" ] && [ "$2" == "--kanye" ]; then
/usr/bin/git commit -m "$(curl -X GET http://api.kanye.rest/ | jq '.quote')";
else
/usr/bin/git $@
fi
}
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 2.
id,name,description,revenue
21420887,Snazzy Flat in Marigny: 10min Walk to Frenchmen St,"Classic 2 bedroom, 1 bath 1917 Shotgun Flat in the heart of the Marigny/Bywater! You'll be surrounded by great local restaurants, bars and cafes in Marigny and the Bywater areas, including The Franklin, Mimi's, and Suis Generis. Built in the early 1900s, this beautiful traditional shotgun flat features original heart-of-pine floors, 12-foot-ceilings, a modern kitchen, and an inviting backyard space. The space was newly decorated and furnished in 2017 with attention to comfort and detail. The space is a 2 bedroom, 1 bathroom traditional shotgun layout. The space is five rooms and a bathroom - lined up one behind the other with doors in-between: the living room, first bedroom, second bedroom, dining room, kitchen and bathroom. Each bedroom features a Queen-size bed, blackout curtains, a white noise machine, bathrobes, and throwaway slippers. The home features 12-foot- ceilings, original heart-of-pine wood floors, and mo
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 2.
id,name,description,revenue
21420887,Snazzy Flat in Marigny: 10min Walk to Frenchmen St,"Classic 2 bedroom, 1 bath 1917 Shotgun Flat in the heart of the Marigny/Bywater! You'll be surrounded by great local restaurants, bars and cafes in Marigny and the Bywater areas, including The Franklin, Mimi's, and Suis Generis. Built in the early 1900s, this beautiful traditional shotgun flat features original heart-of-pine floors, 12-foot-ceilings, a modern kitchen, and an inviting backyard space. The space was newly decorated and furnished in 2017 with attention to comfort and detail. The space is a 2 bedroom, 1 bathroom traditional shotgun layout. The space is five rooms and a bathroom - lined up one behind the other with doors in-between: the living room, first bedroom, second bedroom, dining room, kitchen and bathroom. Each bedroom features a Queen-size bed, blackout curtains, a white noise machine, bathrobes, and throwaway slippers. The home features 12-foot- ceilings, original heart-of-pine wood floors, and mo
We can't make this file beautiful and searchable because it's too large.
id,name,description,est_revenue
22333114,Residences Du Carondelet #1531,Residences du Carondelet (Residences on Carondelet) are Vacation Residences built in the style of traditional Garden District cottages. The residences are located on Carondelet Street one block off St. Charles Street. Just adjacent to everything the Garden District offers in NOLA. This Spacious 3 Bedroom 2.5 Bath Carondelet St residence has spacious Kitchen Living and Dining area downstairs complete with a half Bath. The 3 Bedrooms and 2 Baths are located on the second level along with a Balcony that overlooks Carondelelt St. The secure gated compound layout has a large private courtyard shared by all units as well as a swimming pool. Six of the units are new construction and four of the units are modern updates of a turn of the century structure. Complete with recessed lighting and granite countertops. All units have century-old wood flooring and updated appliances and the newer units have exquisite quartz countertops. Street car -
import matplotlib.pyplot as plt
import numpy as np
import torch
from torch.autograd import Variable
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import torchvision
import torchvision.transforms as transforms
@niklio
niklio / reorder.py
Last active April 18, 2017 04:03
Reorder arbitrary partition of a .wav file.
import math
import os
import pdb
import matplotlib.pyplot as plt
from munkres import Munkres # Because big data + I only remember Hungarian
import numpy as np
from scipy.io import wavfile
from tqdm import tqdm
@niklio
niklio / decrypt_env.sh
Last active April 9, 2017 04:21
Shell scripts for encrypting and decrypting environment variables so you can add them to version control
parent ()
{
if [[ "$OSTYPE" == "darwin"* ]];
then
command -v greadlink >/dev/null 2>&1 || { echo >&2 "Missing dependency: greadlink. Aborting."; exit 1; }
echo "$( greadlink -f "$1" )";
else
command -v readlink >/dev/null 2>&1 || { echo >&2 "Missing dependency: readlink. Aborting."; exit 1; }
echo "$( readlink -f "$1" )";
fi
@niklio
niklio / serializers.py
Last active March 19, 2017 00:11
DRF Dynamic Serializer
class DynamicFieldsModelSerializer(serializers.ModelSerializer):
"""
Django rest framework dynamic serializer based on
http://www.django-rest-framework.org/api-guide/serializers/#dynamically-modifying-fields.
Gets the lists 'fields' and 'exclude' directly from the query parameters so it expects
the url to look something like:
https://api.example.com/resource/?fields=id&fields=name&exclude=id
"""
def __init__(self, *args, **kwargs):
@niklio
niklio / wer.py
Created February 7, 2017 22:26
Word error rate script
from __future__ import division
import os
import numpy
import argparse
def wer(r, h):
d = numpy.zeros((len(r)+1)*(len(h)+1), dtype=numpy.uint8)
d = d.reshape((len(r)+1, len(h)+1))
for i in xrange(len(r)+1):