Skip to content

Instantly share code, notes, and snippets.

View andzi's full-sized avatar

andzil andzi

View GitHub Profile
@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 / 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:
@mhawksey
mhawksey / gist:1442370
Last active July 9, 2025 12:26
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;
}