Skip to content

Instantly share code, notes, and snippets.

View leppie's full-sized avatar
🤡

Llewellyn Pritchard leppie

🤡
  • Cape Town, South Africa
View GitHub Profile
@leppie
leppie / gist:2868328
Created June 4, 2012 13:20
CallWithEscapeContinuation Usage
using System;
using System.Linq;
class Program
{
sealed class EscapeContinuation<T> : Exception
{
public T Value { get; private set; }
public void Raise(T value)
class Program
{
// What argument do you need to provide to this method so that it returns true?
public static bool AreYouNuts<T>(T[] array)
{
if (array == null || array.Length == 0)
return false;
var local = (T[]) array.Clone();
using System;
using System.Linq;
class Program
{
static void Main()
{
if (true.Any is object) { }
if (ICloneable.Clone is object) { }
}
@naikrovek
naikrovek / visascope.cs
Created May 28, 2014 22:15
Simple little test app I wrote to test VISA instrument control. This will require changes in order to be useful. BONUS: Dumper class, useful for many things around the house!
using Ivi.Visa.Interop;
using System;
using System.IO;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Runtime.Remoting;
using System.Runtime.Serialization;
namespace ConsoleApplication1 {
@ktakashi
ktakashi / ChangeLog
Last active October 21, 2024 22:17
Portable(?) R6RS er-macro-transformer
2015-10-24
- Changed comment
- Walk though returning form to wrap. Racket still doesn't work.
- Fixed incorrect example on definition of macro and usage environment.
Comment of: https://twitter.com/anohana/status/657865512370634753
@joeduffy
joeduffy / ndisasm.bat
Created December 11, 2015 17:59
A handy .NET disassembler script
@ECHO OFF
REM A handy, dandy script for disassembling .NET programs.
SETLOCAL EnableDelayedExpansion
ECHO .NET Program Disassembler
ECHO =========================
REM Pluck out arguments and validate paths.
SET BINARY=%1
IF [%BINARY%]==[] (
ECHO error: missing program binary to disassemble
@leppie
leppie / foo.cmd
Last active February 10, 2016 18:04
Command line parsing in a batch file (or scripting for the mildly insane)
@echo off
setlocal EnableDelayedExpansion
:: user settings
set VERBOSE=0
set ERRORS=0
:: arg parsing settings
set ARGS=verbose debug-mode
@alirobe
alirobe / reclaimWindows10.ps1
Last active November 15, 2024 12:08
This Windows 10 Setup Script turns off a bunch of unnecessary Windows 10 telemetery, bloatware, & privacy things. Not guaranteed to catch everything. Review and tweak before running. Reboot after running. Scripts for reversing are included and commented. Fork of https://github.com/Disassembler0/Win10-Initial-Setup-Script (different defaults). N.…
###
###
### UPDATE: For Win 11, I recommend using this tool in place of this script:
### https://christitus.com/windows-tool/
### https://github.com/ChrisTitusTech/winutil
### https://www.youtube.com/watch?v=6UQZ5oQg8XA
### iwr -useb https://christitus.com/win | iex
###
###
public class Startup : IStartup
{
private static readonly Assembly[] ControllerAssemblies = { typeof(Startup).GetTypeInfo().Assembly };
public Startup(IHostingEnvironment environment, ILoggerFactory logging)
{
Environment = environment;
ConfigureLogging(logging);
}
public static bool ContainsTokenUnroll(string value, string token, char delimiter = ';')
{
if (string.IsNullOrEmpty(token)) return false;
if (string.IsNullOrEmpty(value)) return false;
var valueLength = value.Length;
var tokenLength = token.Length;
if (tokenLength > valueLength) return false;