Skip to content

Instantly share code, notes, and snippets.

View idiotandrobot's full-sized avatar

Michael Phillips idiotandrobot

View GitHub Profile
@idiotandrobot
idiotandrobot / Enumerate Jpeg Properties.ps1
Last active September 12, 2017 09:56
Enumerate all properties for jpegs in the current folder
$propertyname = @{
0x013B= "PropertyTagArtist";
0x0102= "PropertyTagBitsPerSample";
0x0109= "PropertyTagCellHeight";
0x0108= "PropertyTagCellWidth";
0x5091= "PropertyTagChrominanceTable";
0x0140= "PropertyTagColorMap";
0x501A= "PropertyTagColorTransferFunction";
0x0103= "PropertyTagCompression";
0x8298= "PropertyTagCopyright";
@idiotandrobot
idiotandrobot / AsyncLazy<T>.v2.cs
Created September 9, 2017 09:30
AsyncLazy<T> v2
// via http://blog.stephencleary.com/2012/08/asynchronous-lazy-initialization.html
/// <summary>
/// Provides support for asynchronous lazy initialization. This type is fully threadsafe.
/// </summary>
/// <typeparam name="T">The type of object that is being asynchronously initialized.</typeparam>
public sealed class AsyncLazy<T>
{
/// <summary>
/// The underlying lazy task.
/// </summary>
@idiotandrobot
idiotandrobot / AsyncLazy<T>.v1.cs
Created September 9, 2017 09:28
AsyncLazy<T> v1
// https://blogs.msdn.microsoft.com/pfxteam/2011/01/15/asynclazyt/
public class AsyncLazy<T> : Lazy<Task<T>>
{
public AsyncLazy(Func<T> valueFactory) :
base(() => Task.Factory.StartNew(valueFactory)) { }
public AsyncLazy(Func<Task<T>> taskFactory) :
base(() => Task.Factory.StartNew(() => taskFactory()).Unwrap()) { }
public TaskAwaiter<T> GetAwaiter() { return Value.GetAwaiter(); }
import numpy as np
#Un'goro Numbers
numcom=49
numrare=36
numepic=27
numlegend=23
@idiotandrobot
idiotandrobot / crontab
Created December 22, 2016 09:48
Automate heathergraph update from github
0 0,8,12,16 * * * /home/pi/heathergraph_update.sh > /home/pi/heathergraph_update.log 2>&1
@idiotandrobot
idiotandrobot / raspi-vscode.sh
Last active November 12, 2016 22:41
Compiling Visual Studio Code on a Raspberry Pi
wget http://node-arm.herokuapp.com/node_latest_armhf.deb
sudo dpkg -i node_latest_armhf.deb
sudo apt-get install libx11-dev
git clone https://github.com/microsoft/vscode
cd vscode
git checkout 1.0.0
./scripts/npm.sh install --arch=armhf
sudo apt-get purge nodejs -y
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 68576280
sudo apt-add-repository "deb https://deb.nodesource.com/node_4.x precise main"
sudo apt-get update
sudo apt-get install nodejs
sudo apt-get update
sudo apt-get install ruby-full
sudo gem install jekyll
sudo gem install jekyll-sitemap
sudo gem install jekyll-redirect-from
[DllImport("user32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool AddClipboardFormatListener(IntPtr hwnd);
[DllImport("user32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool RemoveClipboardFormatListener(IntPtr hwnd);
private const int WM_CLIPBOARDUPDATE = 0x031D;
@idiotandrobot
idiotandrobot / Dropbox.cs
Last active April 19, 2016 09:43
Dropbox Windows Folder path
using Newtonsoft.Json.Linq;
using System;
using System.IO;
public static class Dropbox
{
private static string _Path;
public static string Path
{
get { return _Path ?? (_Path = GetPath()); }