Skip to content

Instantly share code, notes, and snippets.

@yzorg
yzorg / IE 'Send to Chrome' bookmarklet
Last active December 11, 2015 03:08 — forked from anonymous/gist:4334192
'Send to Chrome' button in IE, adds chrome2:// protocol to Windows
// in desktop IE and metro IE - create a bookmark with the line below
javascript:document.location=("chrome2://"+document.location)
@yzorg
yzorg / profile.ps1
Last active February 2, 2020 17:12
Added $gitbin
echo "START [$($MyInvocation.MyCommand.Name)] $(get-date -f yyyyMMdd.HHmmss.ff)"
try {
#$env:Path += ";.\node_modules\.bin" # use npmx instead (v8.2+ / npm 5.3+)
sal code "C:\Program Files\Microsoft VS Code\Code.exe"
# cd to the first directory in the path that contains a program, script, or file
filter goWhere { where.exe $args | select -first 1 | Split-Path -Parent | pushd }
#filter goWhereCD { where.exe $args | select -first 1 | Split-Path -Parent | cd }
using System.Text;
namespace Yzorg.Gist {
class NoteBuilder : IDisposable {
StringBuilder _note;
Func<string> _get;
Action<string> _set;
public NoteBuilder(Func<string> get, Action<string> set) {
# my version of http://stackoverflow.com/a/3364468/195755
netsh http add urlacl ("url=http://{0}:{1}/" -f $env:COMPUTERNAME,64199) user=everyone
@yzorg
yzorg / gist:11307678
Last active December 14, 2019 23:34
nodejs mail-listener2 gmail demo
// sample adapted from mail-listener2
var MailListener = require("mail-listener2");
var mailListener = new MailListener({
username: "your-user@gmail.com",
password: "get-an-app-token-from-google", // works for me: https://accounts.google.com/b/0/IssuedAuthSubTokens?hide_authsub=1
host: "imap.gmail.com",
port: 993, // imap port
tls: true,
@yzorg
yzorg / CreateHardLinks.ps1
Last active August 29, 2015 14:06
recursive create hardlinks
@yzorg
yzorg / local-git-setup.ps1
Last active August 29, 2015 14:20
create a local GIT folder for windows: create directory links for default SQL Server Management Studio and WindowsPowershell directories
pushd C:\Projects\local-git
$poshdir = $(gi '~\Documents\WindowsPowershell' | select -exp FullName)
cmd /c mklink /J PowerShell $poshdir
$sqldir = $(gi '~\Documents\SQL Server Management Studio' | select -exp FullName)
cmd /c mklink /J SSMS $sqldir
# path to cspack
$cspackPath = Join-Path $env:ProgramFiles 'Microsoft SDKs\Azure\.NET SDK\v2.7\bin\cspack.exe'
$PackagePath = 'c:\mycloudpackage.cspkg'
$serviceDefinitionFile = 'c:\myProject\ServiceDefinition.csdef'
$webRoleName = 'MyWebRole'
$webRolePath = 'c:\myProject'
$webRoleEntryPoint = 'MyWebRole.dll'
# define the cspack parameters
@yzorg
yzorg / CopyFileList.ps1
Created September 17, 2015 02:28
copy selective list of files from text file using PowerShell and xcopy
'c:\git\mycompany_prj2\Legacy\Comp1\f1.cs
c:\git\mycompany_prj2\Legacy\Comp2\Domain\f2.cs
c:\git\mycompany_prj2\Legacy\MyWeb\web.config' > files.txt
cd c:\git\mycompany_prj2
$dest = '..\project_archive\prep_6.11_merge'
if (!(Test-Path $dest)) { md $dest -Verbose }
gc .\files.txt | %{
$rel = (Resolve-Path -Relative $_)
xcopy $_ (Join-Path $dest $rel*) /Y