Skip to content

Instantly share code, notes, and snippets.

@mgrigajtis
mgrigajtis / gist:e8cc737ecf405b14bf24
Created May 29, 2014 13:53
Parsing ElasticSearch Results with Java
import java.io.BufferedInputStream;
import java.net.URL;
import java.net.URLConnection;
import org.json.JSONArray;
import org.json.JSONObject;
protected void foo () {
// The input stream from the JSON response
BufferedInputStream buffer = null;
@trentbrooks
trentbrooks / gist:11392776
Created April 29, 2014 07:18
Download all images from website (1-88 on gratisography.com) with curl
curl "http://www.gratisography.com/pictures/[1-88]H.jpg" -o "#1.jpg"
@protrolium
protrolium / YouTube API — getting video thumbnail
Created February 5, 2014 19:57
YouTube API — getting video thumbnail
Each YouTube video has 4 generated images. They are predictably formatted as follows:
http://img.youtube.com/vi/<insert-youtube-video-id-here>/0.jpg
http://img.youtube.com/vi/<insert-youtube-video-id-here>/1.jpg
http://img.youtube.com/vi/<insert-youtube-video-id-here>/2.jpg
http://img.youtube.com/vi/<insert-youtube-video-id-here>/3.jpg
The first one in the list is a full size image and others are thumbnail images. The default thumbnail image (ie. one of 1.jpg, 2.jpg, 3.jpg) is:
http://img.youtube.com/vi/<insert-youtube-video-id-here>/default.jpg
function setWeatherIcon(condid) {
switch(condid) {
case '0': var icon = '<i class="wi-tornado"></i>';
break;
case '1': var icon = '<i class="wi-storm-showers"></i>';
break;
case '2': var icon = '<i class="wi-tornado"></i>';
break;
case '3': var icon = '<i class="wi-thunderstorm"></i>';
@kriskhaira
kriskhaira / checkdns
Created November 28, 2010 16:14
Useful for checking DNS propagation with Google Public DNS and OpenDNS after migrating servers
#!/bin/bash
# checkdns
# A very simple dig tool for checking DNS propagation with Google Public DNS and OpenDNS after migrating servers
#
# INSTRUCTIONS
# Put this in your ~/bin folder, make it executable and run it by typing "checkdns" in your command line
read -p "Enter domain: " domain
# Google Public DNS