Skip to content

Instantly share code, notes, and snippets.

View andzi's full-sized avatar

andzil andzi

View GitHub Profile
@mhawksey
mhawksey / gist:1442370
Last active February 25, 2024 12:01
Google Apps Script to read JSON and write to sheet
function getJSON(aUrl,sheetname) {
//var sheetname = "test";
//var aUrl = "http://pipes.yahoo.com/pipes/pipe.run?_id=286bbb1d8d30f65b54173b3b752fa4d9&_render=json";
var response = UrlFetchApp.fetch(aUrl); // get feed
var dataAll = JSON.parse(response.getContentText()); //
var data = dataAll.value.items;
for (i in data){
data[i].pubDate = new Date(data[i].pubDate);
data[i].start = data[i].pubDate;
}
@aksiksi
aksiksi / products.py
Created December 28, 2011 23:31
Finds all products of the digits of 5-digit numbers and creates two files: one contains the products and keys, ranked by products, while the other contains the number of occurrences of each product, ranked by occurrence, both in ascending order.
# Written by Assil Ksiksi
# Date: Thursday, December 29th, 3:12 am (GMT +4)
# I basically wrote this to determine whether or not a pattern exists in the products of the digits
# of all 5-digit numbers. Sadly, none exist, or at least I didn't see one.
# Runtime is fairly slow. It takes 1.05916786194s for all 5-digit numbers. I don't see how it
# can be optimized, so that should do the trick.
# References:
@jpoehls
jpoehls / xpath-example.ps1
Created May 18, 2012 18:44
Use XPath to update XML using PowerShell
function Edit-XmlNodes {
param (
[xml] $doc = $(throw "doc is a required parameter"),
[string] $xpath = $(throw "xpath is a required parameter"),
[string] $value = $(throw "value is a required parameter"),
[bool] $condition = $true
)
if ($condition -eq $true) {
$nodes = $doc.SelectNodes($xpath)
@aksiksi
aksiksi / imdbtop250-scrape.py
Created July 7, 2012 18:08
Scrapes IMDB Top 250 list and writes data to a database.
#################################################################
## Written by: Assil Ksiksi ##
## ## ## ##
## Scrapes IMDB for movie IDs, makes API requests, then writes ##
## the results to a database. ##
## ## ## ##
#################################################################
import re, requests, sqlite3, json, time
@mminer
mminer / pocket.py
Created July 27, 2012 06:45
A script to save URLs to Pocket (read it later service).
#!/usr/bin/env python
"""
Saves URL(s) to a user's Pocket queue.
It accepts either command line arguments or a URL from the OS X clipboard.
For information about Pocket see http://getpocket.com/
"""
import optparse
import subprocess
@oumu
oumu / Evernote ENML Editor Revamp.css
Created October 4, 2012 13:21
#css #userscript : Evernote ENML Editor Revamp
div.head, div.foot {
display:none;
}
.page {
width:99%;
}
.body {
background:url(data:image/png;
base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAAHCAYAAADEUlfTAAAAG0lEQVQIW2OMq7zlw4ADMIIkF7WrbcEmP+gkAarWGgXyq5CNAAAAAElFTkSuQmCC) repeat;
border-top:0;
@kshwetabh
kshwetabh / GMailReminder.gs
Created February 11, 2013 02:09
Reminder script for GMail: A simple Google Apps Script to create a Google Calendar event (reminder) for any mail (with a specific label). You can then setup ("timed") triggers in Apps Script... (public version of the GMailReminder gist)
/**
* Reminder script for GMail: A simple Google Apps Script to create a Google Calendar event (reminder) for any mail (with a
* specific label). You can then setup ("timed") triggers in Apps Script (hourly, etc) to monitor your Inbox.
* How to Use:
* 1. Log into Google Drive account and create a Google Script.
* 2. Copy and paste the below snippet into the gs file.
* 3. Make sure to update the 'reminderLabel', 'calendarName' and 'reminderDuration' as per your preference.
* 4. Test the script to make sure it is working properly.
* 5. Setup a time-driven Project Trigger (hourly, etc) to automatically run this script and create calendar events.
*
@mndrix
mndrix / scrape.prolog
Last active October 23, 2016 02:20
speculative sketch of a web scraper in Prolog with XPath, regular expressions and constraints
% The numerous inline comments are explanatory. Normal code wouldn't have them.
% I'm using double quotes to delineate raw text content. Real code would use
% a quasiquotation mechanism.
amazon_condition_overview(ASIN, Condition, BestPrice, Inventory, Section) :-
% HTTP GET the URL and parse it into a DOM structure
get(url("amazon.com/gp/offer-listing/$ASIN/?ie=UTF8"), DOM),
% build an atom representing the tab's node ID
TabId = qq("olpTab$Condition"),
@TomByrne
TomByrne / MultiExporter.jsx
Last active June 14, 2024 09:48
An Illustrator script for exporting layers and/or artboards into separate files (PNG8 / PNG24 / EPS / PDF / SVG / JPG / FXG).See http://www.tbyrne.org/export-illustrator-layers-to-svg-files
// MultiExporter.jsx
// Version 0.1
// Version 0.2 Adds PNG and EPS exports
// Version 0.3 Adds support for exporting at different resolutions
// Version 0.4 Adds support for SVG, changed EPS behaviour to minimise output filesize
// Version 0.5 Fixed cropping issues
// Version 0.6 Added inner padding mode to prevent circular bounds clipping
//
// Copyright 2013 Tom Byrne
// Comments or suggestions to tom@tbyrne.org
@lorenzoplanas
lorenzoplanas / ted.csv
Created December 25, 2013 20:55
Script to get direct download URLs for TED conferences
We can't make this file beautiful and searchable because it's too large.
URL,ID,URL,Speaker,Name,Short Summary,Event,Duration,Publish date
http://www.ted.com/talks/view/id/,1,http://www.ted.com/talks/view/id/1,Al Gore,15 ways to avert a climate crisis,"With the same humor and humanity he exuded in An Inconvenient Truth, Al Gore spells out 15 ways that individuals can address climate change immediately, from buying a hybrid to inventing a new, hotter ""brand name"" for global warming.",TED2006,0:16:17,6/27/2006
http://www.ted.com/talks/view/id/,92,http://www.ted.com/talks/view/id/92,Hans Rosling,Debunking third-world myths with the best stats you've ever seen,"You've never seen data presented like this. With the drama and urgency of a sportscaster, statistics guru Hans Rosling debunks myths about the so-called ""developing world.""",TED2006,0:19:50,6/27/2006
http://www.ted.com/talks/view/id/,66,http://www.ted.com/talks/view/id/66,Sir Ken Robinson,Do schools kill creativity?,Sir Ken Robinson makes an entertaining and profoundly moving case for creating an education system that nurtu