Skip to content

Instantly share code, notes, and snippets.

View luciovilla's full-sized avatar

Lucio Villa luciovilla

View GitHub Profile
@luciovilla
luciovilla / Makefile
Last active August 29, 2015 14:18 — forked from paulsmith/Makefile
all: results.csv
results.csv: scrape.py
python $< > [email protected]
mv [email protected] $@
clean:
-rm -f results.csv
.PHONY : clean
@luciovilla
luciovilla / .zshrc
Last active February 25, 2016 20:49 — forked from SlexAxton/.zshrc
My gif workflow
gifify() {
if [[ -n "$1" ]]; then
if [[ $2 == '--good' ]]; then
ffmpeg -i $1 -r 10 -vcodec png out-static-%05d.png
time convert -verbose +dither -layers Optimize -resize 600x600\> out-static*.png GIF:- | gifsicle --colors 128 --delay=5 --loop --optimize=3 --multifile - > $1.gif
rm out-static*.png
else
ffmpeg -i $1 -s 600x400 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=3 > $1.gif
fi
else
@luciovilla
luciovilla / geolocation_script.gs
Created February 23, 2016 21:27
Geo Location Script for Google Spreadsheet
function getLat(address) {
if (address == '') {
Logger.log("Must provide an address");
return;
}
var geocoder = Maps.newGeocoder();
var location;
// Geocode the address and plug the lat, lng pair into the
// 2nd and 3rd elements of the current range row.
location = geocoder.geocode(address);
import csv
import time
from pygeocoder import Geocoder
from pygeocoder import GeocoderError
# We can only geocode up to 2500 properties a day (per IP Address)
input_file = open('data.csv', 'r') # Opens the .csv file
output_file = open('data_new.csv', 'w') # Make an empty .csv This is where your geocodes will end up.
data = csv.reader(input_file)
@luciovilla
luciovilla / t-migrahack16-cli.md
Last active June 3, 2016 15:11 — forked from dannguyen/t-nicar16-cli.md
Using the command-line tools t and csvkit to track the #Migrahack hashtag

Using the t and csvkit to quickly collect and analyze #migrahack tweets from the command-line

The t command-line Twitter tool is a great way to work with Twitter information in a spreadsheet.

Its homepage with good installation instructions is here:

https://github.com/sferik/t

And I've written some related instructions about how to get an authentication token from Twitter:

@luciovilla
luciovilla / ffmpeg_commands.md
Last active July 15, 2021 21:43
Useful ffmpeg commands for newsrooms

Useful ffmpeg commands for newsrooms

Quickly resize, convert, extract audio from videos and edit audio from the command line.

About ffmpeg

A complete, cross-platform solution to record, convert and stream audio and video. https://ffmpeg.org

Installing

Install Homebrew first

@luciovilla
luciovilla / imagemagic_commands.md
Created August 1, 2016 19:21
Useful imagemagick commands for newsrooms

Useful ImageMagick commands for newsrooms

Quickly create, edit, compose or convert images from the command line.

www.imagemagick.org

Installing

$ brew install imagemagick
@luciovilla
luciovilla / cal_fires_kmlz.md
Created October 20, 2017 19:31
Useful tools for handling KML files
@luciovilla
luciovilla / dateConverter.js
Created July 16, 2018 17:56
Convert current date to AP style
function dateConverter(timeStamp){
var UNIX_timestamp = new Date(timeStamp.replace(/\s/, 'T')).getTime();
var a = new Date(UNIX_timestamp);
var months = ['Jan.','Feb.','March','April','May','June','July','Aug.','Sept.','Oct.','Nov.','Dec.'];
var year = a.getFullYear();
var month = months[a.getMonth()];
var day = a.getDate();
var time = month + ' ' + day + ', ' + year ;
return time;
}
@luciovilla
luciovilla / addTeam2Repo.js
Created March 6, 2020 02:50
adding github team to org repo in node with octokit js
#!/usr/bin/node
const { Octokit } = require('@octokit/rest')
const octokit = new Octokit({
auth: AUTH_TOKEN,
})
const addTeam2Repo = async () => {
try {
await octokit.teams.addOrUpdateRepoInOrg({