Skip to content

Instantly share code, notes, and snippets.

@jamesrcounts
jamesrcounts / CreateHash.cs
Created December 11, 2014 20:20
Snippet to create a hash as a hex string
public static async Task<string> CreateHash(Stream stream)
{
byte[] b;
using (var ctx = new System.Security.Cryptography.SHA256Managed())
{
var input = await stream.ReadDataAsync();
b = ctx.ComputeHash(input);
}
@jamesrcounts
jamesrcounts / if2hash.java
Created March 12, 2015 06:39
IF to Hash refactoring
//1) Starting code...
Color color;
if (branchLength == 10) {
color = PenColors.Greens.Lime;
} else if (branchLength == 20) {
@jamesrcounts
jamesrcounts / starter.cmd
Created March 20, 2015 16:35
vb6 boxstarter
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions
choco install googlechrome
choco install sublimetext2
choco install console2
choco install sourcecodepro
choco install githubforwindows
choco install tortoisemerge
choco install pscx
@jamesrcounts
jamesrcounts / index.html
Last active August 29, 2015 14:17
Highlight Match Directive
<!DOCTYPE html>
<html>
<head>
<title>AngularJS Tutorials</title>
<link rel="stylesheet" href="//cdn.jsdelivr.net/foundation/5.4.7/css/foundation.css">
</head>
<body>
<div ng-app="myApp">
<!-- we've replaced the use of $scope with the preferred "controller as" syntax. see: http://toddmotto.com/digging-into-angulars-controller-as-syntax/-->
@jamesrcounts
jamesrcounts / starter.cmd
Created March 30, 2015 16:53
Minimal box starter
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions
choco install googlechrome
Install-WindowsUpdate
Set-ExecutionPolicy -Force Unrestricted
@jamesrcounts
jamesrcounts / RecursiveSquare.java
Created April 16, 2015 15:48
Recursive Square Attempt
package org.teachingkidsprogramming.section05recursion;
import org.teachingextensions.logo.Tortoise;
public class RecursiveSquare
{
public static void main(String[] args) throws Exception
{
Tortoise.setSpeed(10);
double length = 100.0;
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=$HOME/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.com/install.sh | sh
@jamesrcounts
jamesrcounts / TortoiseReporter.py
Created June 5, 2015 17:59
Tortise Text Reporter for Python
from subprocess import call
from approvaltests.Reporter import Reporter
class TortoiseTextReporter(Reporter):
@staticmethod
def get_command(approved_path, received_path):
return ['C:\\Program Files\\TortoiseSVN\\bin\\tortoisemerge.exe', received_path, approved_path]
@jamesrcounts
jamesrcounts / starter.txt
Last active March 7, 2020 04:09
Boxstarter: Windows 10
# http://boxstarter.org/package/url?
Disable-BingSearch
Disable-GameBarTips
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions
Enable-WindowsOptionalFeature -Online -FeatureName containers ?All
choco install Microsoft-Hyper-V-All -source windowsFeatures
@jamesrcounts
jamesrcounts / 0.py
Created June 11, 2015 18:50
Python Challenge 0
url = "http://www.pythonchallenge.com/pc/def/%s.html"
print(url % 2**38)