Skip to content

Instantly share code, notes, and snippets.

$installLocation = "$env:LocalAppData\Programs\PowerToys"
$tempDir = Join-Path ([System.IO.Path]::GetTempPath()) (New-Guid)
New-Item -ItemType Directory -Path $tempDir -Force | Out-Null
Push-Location $tempDir
$latestPowerToys = Invoke-WebRequest "https://api.github.com/repos/microsoft/PowerToys/releases/latest" | ConvertFrom-Json
$latestVersion = $latestPowerToys.tag_name.Substring(1)
$isInstalled = Test-Path "$installLocation\PowerToys.exe"
if ($isInstalled) {
@cedar101
cedar101 / get_intervals.py
Last active March 22, 2017 08:51
Get intervals from iterator
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
from itertools import accumulate, groupby, islice, tee
from operator import itemgetter
from collections import deque
from functools import partial, wraps
def trace_iter(source):
@cedar101
cedar101 / transcribe.py
Created August 29, 2012 07:57 — forked from ehazlett/transcribe.py
Logs Redis Pub/Sub messages to MongoDB
#!/usr/bin/env
#
# Requirements:
# argparse==1.2.1
# pymongo==2.1
# redis==2.4.10
import redis
import pymongo
import argparse
@cedar101
cedar101 / gist:2921400
Created June 13, 2012 02:17 — forked from karussell/elasticsearch-import-data
ElasticSearch from SQL DB
@cedar101
cedar101 / ElasticSearch Bulk Indexing.java
Created June 13, 2012 02:08 — forked from dav-rob/ElasticSearch Bulk Indexing
ElasticSearch Bulk Indexing from JDBC Input
package ****.elasticsearch.index;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.commons.logging.Log;
@cedar101
cedar101 / elasticsearch_cache.pl
Created June 11, 2012 07:48 — forked from rafl/elasticsearch_cache
Munin ElasticSearch plugins
#!/usr/bin/env perl
# Parameters supported:
#
# config
# autoconf
#
# Magic markers:
#%# family=auto
#%# capabilities=autoconf
@cedar101
cedar101 / gist:2372732
Created April 13, 2012 01:40 — forked from pulkitsinghal/gist:1932711
Ramping Up on ElasticSearch Query DSL
// 1) Lets start with the simplest query that you can run in
// the head plugin for ElasticSearch located at the url:
// http://localhost:9200/_plugin/head/
{
"query": {
"match_all": {}
}
}
// 2) Before jumping into forming queries with the ES Query DSL