Skip to content

Instantly share code, notes, and snippets.

View anotherlab's full-sized avatar

Chris Miller anotherlab

View GitHub Profile
using System;
using System.Text.RegularExpressions;
public class Program
{
public void Main()
{
string[] guids = {
"0C885DD3-7DD9-484B-9B20-3E6552BCA144",
// Photoshop Script to Create iPhone Icons from iTunesArtwork//// WARNING!!! In the rare case that there are name collisions, this script will// overwrite (delete perminently) files in the same folder in which the selected// iTunesArtwork file is located. Therefore, to be safe, before running the// script, it's best to make sure the selected iTuensArtwork file is the only// file in its containing folder.//// Copyright (c) 2010 Matt Di Pasquale// Added tweaks Copyright (c) 2012 by Josh Jones http://www.appsbynight.com//// Permission is hereby granted, free of charge, to any person obtaining a copy// of this software and associated documentation files (the "Software"), to deal// in the Software without restriction, including without limitation the rights// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell// copies of the Software, and to permit persons to whom the Software is// furnished to do so, subject to the following conditions://// The above copyright notice and
@anotherlab
anotherlab / notefreq.h
Created May 19, 2017 18:29
Music notes defined as constants
#define A3 110
#define B3 123
#define C3 131
#define D3 147
#define E3 165
#define F3 175
#define FS3 185
#define G3 392
#define A4 220
#define B4 247
@anotherlab
anotherlab / FinalCountDown.c
Last active May 19, 2017 18:32
C code to play the opening notes of "The Final Countdown" on an Elatec TWN4 RFID reader
void FinalCountDown(void)
{
int v = 100;
int duration = 125;
Beep(v, CS5, duration, 10);
Beep(v, B4, duration, 10);
Beep(v, CS5, duration*4, 10);
Beep(v, FS3, duration*5, duration*5);
Beep(v, D5, duration, 10);
@anotherlab
anotherlab / SmokeOnTheWater.c
Last active May 19, 2017 20:08
The opening notes of "Smoke On The Water"
void Smoke()
{
int v = 50;
int duration = 500;
Beep(v, 2940, duration, 10);
Beep(v, 3490, duration, 10);
Beep(v, 3920, duration * 1.5, 150);
Beep(v, 2940, duration, 10);
@anotherlab
anotherlab / Create Android Icons.jsx
Created November 13, 2014 18:07
Photoshop script to resize 1024x1024 png into Android icons
// Photoshop Script to Create Android Icons from iTunesArtwork
//
// WARNING!!! In the rare case that there are name collisions, this script will
// overwrite (delete perminently) files in the same folder in which the selected
// iTunesArtwork file is located. Therefore, to be safe, before running the
// script, it's best to make sure the selected iTuensArtwork file is the only
// file in its containing folder.
//
// Copyright (c) 2010 Matt Di Pasquale
// Added tweaks Copyright (c) 2012 by Josh Jones http://www.appsbynight.com
@anotherlab
anotherlab / program.cs
Created April 6, 2018 00:57
Using the list of attached webcams
// Get the list of connected video cameras
DsDevice[] devs = DsDevice.GetDevicesOfCat(FilterCategory.VideoInputDevice);
// Filter that list down to the one with hyper-aggressive focus
var dev = devs.Where(d => d.Name.Equals("Microsoft® LifeCam HD-5000")).FirstOrDefault();
@anotherlab
anotherlab / program.cs
Created April 6, 2018 01:10
Creating a video capture filter with DirectShow
if (new FilterGraph() is IFilterGraph2 graphBuilder)
{
// Create a video capture filter for the device
graphBuilder.AddSourceFilterForMoniker(dev.Mon, null, dev.Name, out IBaseFilter capFilter);
// Cast that filter to IAMCameraControl from the DirectShowLib
IAMCameraControl _camera = capFilter as IAMCameraControl;
// Get the current focus settings from the webcam
_camera.Get(CameraControlProperty.Focus, out int v, out CameraControlFlags f);
@anotherlab
anotherlab / get-static-console.ps1
Created July 4, 2020 20:55
Get a list of static members from the system.console class
[system.console] | Get-Member -Static -MemberType property | Format-Table name
@anotherlab
anotherlab / num-lock.ps1
Last active July 5, 2020 04:40
Windows-only script to set the state of the Num Lock key
# One parameter, to set the Num Lock state to On or Off, with
# On as the default
Param(
[Parameter(Mandatory=$false)]
[ValidateSet("On", "Off")]
[String[]] $onoff='On'
)
# Get the current state of the Num Lock key
$CurrentState = [console]::NumberLock