Skip to content

Instantly share code, notes, and snippets.

View vyuh's full-sized avatar

Prashant Karmakar vyuh

View GitHub Profile

Solo data journalist tips and tools

Get to work

Keep lists of story ideas. Include both the simple one-shot stories as well as the bigger projects.

You're the only one doing your stuff, hence you're the only one who remembers how. Once you figure out a skill, document it! Write down a checklist, step-by-step, of how you finished that project. Having a place to start a new project is invaluable.

Start small. Do a simple locator map. A single bar graph or line chart. Then work your way up. Start with a silly project (like a dog name database, popular baby names over time) so -- if you make a mistake -- you won’t have to worry about getting sued. This helps reduce your stress level as you’re learning the ropes.

@vyuh
vyuh / twitter-api
Last active August 29, 2015 14:16
Twitter public REST API
#name #auth #meth #uri #attr #files
rt usr POST 'https://api.twitter.com/1.1/statuses/retweet/'.$attr->{'id'}.'.json' id,trim_user
fav usr POST 'https://api.twitter.com/1.1/favorites/create.json' id,include_entities
GET statuses/mentions_timeline
GET statuses/user_timeline
GET statuses/home_timeline
GET statuses/retweets_of_me
GET statuses/retweets/:id
@vyuh
vyuh / inset_image.html
Created March 18, 2015 05:49
To inset an image into another. Like a profile photo over banner photo. whim.png is 1500x500. t_pic.jpg 353x353. Only aspect ratios are important.
<html>
<head>
<title>Page Title</title>
<style>
.description {
font-family: Georgia, serif;
font-size: .85em;
text-align: center;
}
.wrapper {
@vyuh
vyuh / geometry_pk.py
Created April 2, 2015 16:58
Antialiased Geometric constructions
#-------------------------------------------------------------------------------
# Name: geometry_pk
# Purpose: Simple approach to implementing antialiased graphics.
#
# Author: pk
#
# Created: 30-03-2015
# Copyright: (c) pk 2015
# Licence: ISC
#-------------------------------------------------------------------------------
@vyuh
vyuh / sort_bookmarks_html.pl
Last active August 29, 2015 14:24
Fetches all links as of now. eventually, i want it to remove duplicate bookmarks and then sort them
#!/usr/bin/perl
use HTML::TreeBuilder::XPath;
my $file = shift; # first argument is bookmarks HTML filepath
my $tree = new HTML::TreeBuilder::XPath;
$tree->parse_file($file);
use Data::Dumper;
my @links = $tree->findnodes('//a');
use List::Flatten;
print join ' ', flat @{$_}{ qw/href _content/ }, "\n" for (@links);
#woah http://www.perlmonks.org/?node=References%20quick%20reference
@vyuh
vyuh / sentence.sh
Last active November 24, 2015 17:34
Filter english text files to one sentence per line.
perl -M'Lingua::EN::Sentence qw/get_sentences/' -00 -lne 'tr/\r\n \t/ /s;print join "\n", @{get_sentences $_};'
@vyuh
vyuh / emoji.md
Last active November 24, 2015 17:44 — forked from mmulich/emoji.md
emoji

EMOJI CHEAT SHEET

People

:bowtie: 😄 😆 😊 😃 ☺️

@vyuh
vyuh / captchagen
Created March 5, 2016 14:57
Generate Image for CAPTCHA
#!/usr/bin/perl
$r = join "", map { ( "a".."z", "A".."Z", "0".."9" )[rand 62] } 1..9;
system( qq/convert -size 300x100 -font Courier -gravity center "label:$r" label.bmp/ );
system( q/convert -size 150x50 xc:gray +noise random -blur 1x1 -colorspace gray -scale 300x100 gray.bmp/ );
system( q/convert label.bmp gray.bmp -compose displace -define compose:args=12x12 -composite -blur 1x1 comp.png/ );
@vyuh
vyuh / box2d_build.sh
Created April 21, 2016 13:04
Build Box2d 2.3.0 on Ubuntu
git clone https://github.com/erincatto/Box2D
cd Box2D/Box2D
git branch pk v2.3.0
git checkout pk
cmake .
make
Testbed/Testbed &
@vyuh
vyuh / jekyll_touch.sh
Created May 15, 2016 21:11
rename a file like a jekyll post dated today
#!/bin/sh
# rename a file like a jekyll post dated today
date_filename () {
sep='/';
local file=`basename "$1"`;
local dir=`dirname "$1"`;
local date=`date +%F`;
local bare=`echo "$file" | sed 's/^20\([0-9]\{2\}-\)\{3\}//'`
mv "$1" "$dir$sep$date-$bare";