Skip to content

Instantly share code, notes, and snippets.

View jimbuck's full-sized avatar

Jim Buck jimbuck

View GitHub Profile

Just go to stackoverflow.com then define this in your Javascript console:

(function(myFkey) {
  console.log("Ok, let's hack you some shiny unicoins! <3 /dev/alias (www.devalias.net)")
  console.log("The powers that be say you can only mine a rock every 10sec, so we do it every 11sec to be sure.")
  window.setInterval(function(){
    $.get( "http://stackoverflow.com/unicoin/rock", function( data ) {
      var rockId = data.rock;
      $.post( "http://stackoverflow.com/unicoin/mine?rock=" + rockId, { fkey: myFkey })
 .done(function( data ) {
@jimbuck
jimbuck / InvalidModelException.cs
Created August 11, 2014 17:57
C# Validation Helper
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Runtime.Serialization;
namespace JimmyBoh.Common.Exceptions
{
public class InvalidModelException : Exception
{
@jimbuck
jimbuck / AuthenticationHelper.cs
Created August 13, 2014 21:52
.NET helper class for checking user credentials against Windows.
using System;
using System.Runtime.InteropServices;
using System.Text;
namespace System.Security.Principal
{
/// <summary>
/// Leverages the windows UI to prompt for a password
/// </summary>
public static class AuthenticationHelper
@jimbuck
jimbuck / auto-cookies.js
Last active August 29, 2015 14:05
AutoCookieClicker
//javascript:
(function(){
var bigCookie = document.getElementById('bigCookie');
var cookieClickers;
if(Notification.permission !== 'granted'){
Notification.requestPermission( function(status) {
enableNotifications();
});
} else {
enableNotifications();
@jimbuck
jimbuck / filegen
Created December 19, 2014 18:56
Bulk File Generator
#!/usr/bin/env bash
barWidth=60 # constant
filePadding=8 # constant
extension="file" # constant
count=$1
size=$2
resetFlag=$3
@jimbuck
jimbuck / make64-bookmarklet.txt
Last active December 23, 2015 16:12
Converts the current image to the base64 equivalent.
javascript: !function(){var n=new XMLHttpRequest;n.responseType="blob",n.onload=function(){var e=new FileReader;e.onloadend=function(){window.open(e.result,"_blank")},e.readAsDataURL(n.response)},n.open("GET",window.location.href),n.send()}();
@jimbuck
jimbuck / WindowKeeper.cs
Last active May 3, 2016 20:49
Simple class that maintains the position and size of console windows when debugging in VS. Makes rapid debug cycles a little less frustrating.
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using System.Timers;
namespace CodeGear.Utilities
{
@jimbuck
jimbuck / index.js
Created May 11, 2017 12:52
Get List of Media Devices (not streams)
navigator.mediaDevices.enumerateDevices()
.then(devices => devices.map(d => `[${d.kind}] ${d.label}`))
.then(console.log.bind(console))
@jimbuck
jimbuck / bump.ps1
Created October 4, 2017 00:05
Bump version of csproj
param(
[string]$csproj = $(throw "-csproj is required."),
[ValidateSet('major', 'minor', 'patch')][string]$part = "patch"
)
Function BumpVersion([string]$csprojPath, [int]$majorInc, [int]$minorInc, [int]$patchInc) {
[xml]$xml = (Get-Content $csprojPath)
$buildInfo = $xml.Project.PropertyGroup | Where-Object {$_.Label -eq 'BuildInfo'}
#split product version in SemVer language
@jimbuck
jimbuck / update-node.sh
Created May 25, 2018 21:06
PI Zero NodeJS
#!/bin/bash
version=$1
if [ -z "$version" ]; then
echo Must provide a version!
exit;
fi
filename=node-v$version-linux-armv6l