Skip to content

Instantly share code, notes, and snippets.

View jorgeas80's full-sized avatar
🎯
Focusing

Jorge Arévalo jorgeas80

🎯
Focusing
View GitHub Profile
@k4gdw
k4gdw / instructions.sh
Last active August 24, 2017 16:00 — forked from nachocab/instructions.sh
How to make git diff work perfectly with .docx files in Mac OS X (it even colors by word)
# Execute the following commands one at a time from a bash prompt.
# download docx2txt by Sandeep Kumar
wget -O docx2txt.pl http://www.cs.indiana.edu/~kinzler/home/binp/docx2txt
# make a wrapper
echo '#!/bin/bash
docx2txt.pl $1 -' > docx2txt
chmod +x docx2txt
# make sure docx2txt.pl and docx2txt are your current PATH. Here's a guide
@headwinds
headwinds / gist:8015959
Created December 18, 2013 01:37
FileUploadService - Formidable module for nodejs which you can use instead of the integrated version in Express
var formidable = require('formidable'),
http = require('http'),
util = require('util');
var FileUploadService = {};
FileUploadService.purpose = function(){
console.log("\n");
console.log("-----------------------------------------------");
@tomwhipple
tomwhipple / dms2dec.py
Created September 2, 2012 16:25
convert DMS coordinates to decimal in Python
#!/env/python
# coding=utf8
"""
Converting Degrees, Minutes, Seconds formatted coordinate strings to decimal.
Formula:
DEC = (DEG + (MIN * 1/60) + (SEC * 1/60 * 1/60))
Assumes S/W are negative.
@samgiles
samgiles / postgistogeojson.js
Created April 4, 2012 07:38
A function that converts a PostGIS query into a GeoJSON object.
/*
* A function that converts a PostGIS query into a GeoJSON object.
* Copyright (C) 2012 Samuel Giles <sam@sam-giles.co.uk>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
@za
za / tests.py
Last active June 27, 2018 17:09
django-testing: mock datetime.datetime.now()
import mock
from django.test import TestCase, Client
import datetime
class StubDate(datetime.datetime):
pass
class TestApp(TestCase):
@mock.patch('app.views.datetime.datetime', StubDate) #app is the $django_application_name
@squishybear-zz
squishybear-zz / gist:5446582
Created April 23, 2013 19:23
Try to override the DjangoJSONEncoder.
from django.core.serializers import json
class MyClass(json.DjangoJSONEncoder):
def default(self, o):
return o + 5
json.dumps([1, 2, 3], cls=MyClass)
@danielfrg
danielfrg / merge-files-hdfs-count-pipeline.py
Last active October 15, 2018 16:18
Luigi pipeline: 1. Read a bunch of TDF files from local storage and created a big json file in HDFS 2. Uses a hadoop MR job to count the number of words (this is actually a field on each json object)
import json
import luigi
import luigi.hdfs
import luigi.hadoop
import pandas as pd
import numpy
import pandas
luigi.hadoop.attach(numpy, pandas)
@cerebrl
cerebrl / es6-features.md
Last active March 14, 2019 13:07
Interesting ES6 features
@onyxfish
onyxfish / map.py
Created March 25, 2011 19:33
Django management command to construct a KML map from the Boundary Service
from colorsys import hsv_to_rgb
import json
import logging
log = logging.getLogger('electioncenter.lib.kml')
import struct
from django.contrib.gis.geos import GEOSGeometry
def hsv_to_kml_hex(h, s, v):
"""
@dansup
dansup / .env
Last active August 31, 2019 01:13
PixelFed Alpha Installation
APP_NAME=PixelFed Test
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost
ADMIN_DOMAIN="localhost"
APP_DOMAIN="localhost"
LOG_CHANNEL=stack