This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections.abc import Mapping | |
from typing import Any, Callable, Iterable, MutableMapping, MutableSequence | |
def recurse_object(o: Any, | |
k=None, | |
fn: Callable[[Any,Any,Any],Any]=None, | |
prefn:Callable[[Any,Any],None]=None, | |
postfn:Callable[[Any,Any,Any,Any],Any]=None, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
xclip -selection clipboard -out | xdotool selectwindow windowfocus type --clearmodifiers --delay 25 --window %@ --file - |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE @TableName VARCHAR(MAX) = 'NewsItem' -- Replace 'NewsItem' with your table name | |
DECLARE @TableSchema VARCHAR(MAX) = 'Markets' -- Replace 'Markets' with your schema name | |
DECLARE @result varchar(max) = '' | |
SET @result = @result + 'using System;' + CHAR(13) + CHAR(13) | |
IF (@TableSchema IS NOT NULL) | |
BEGIN | |
SET @result = @result + 'namespace ' + @TableSchema + CHAR(13) + '{' + CHAR(13) | |
END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Sets some UX annoyances in Windows | |
# ************************************************************* | |
# * Change how often Windows asks you for feedback to "NEVER" * | |
# ************************************************************* | |
New-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Siuf\Rules" ` | |
-Name "NumberOfSIUFInPeriod" ` | |
-PropertyType DWORD ` | |
-Value 0x00000000 ` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
no-comments | |
no-emit-version | |
keyid-format 0xlong | |
with-fingerprint | |
verify-options show-uid-validity | |
list-options show-uid-validity | |
use-agent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# See: https://stackoverflow.com/questions/59895/how-to-get-the-source-directory-of-a-bash-script-from-within-the-script-itself | |
# Note: you can't refactor this out: its at the top of every script so the scripts can find their includes. | |
SOURCE="${BASH_SOURCE[0]}" | |
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink | |
DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )" | |
SOURCE="$(readlink "$SOURCE")" | |
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located | |
done | |
SCRIPT_DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bytes" | |
"errors" | |
"fmt" | |
"io" | |
"os" | |
"os/exec" | |
"os/signal" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# See: https://stackoverflow.com/questions/59895/how-to-get-the-source-directory-of-a-bash-script-from-within-the-script-itself | |
SOURCE="${BASH_SOURCE[0]}" | |
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink | |
DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )" | |
SOURCE="$(readlink "$SOURCE")" | |
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located | |
done | |
DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ExclusiveModeSwitcher implements a generic interface for having an arbitrary number of exclusive modes | |
// that should only be activated in exclusion to other modes. The specific assumption is that multiple users | |
// of the same mode should be executed greedily until enough users finish. | |
type ExclusiveModeSwitcher struct { | |
cond *sync.Cond | |
users map[string]uint | |
} | |
// NewExclusiveModeSwitcher constructs a new mode switcher backend. | |
func NewExclusiveModeSwitcher() *ExclusiveModeSwitcher { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// test application for how to switch modes | |
package main | |
import ( | |
"fmt" | |
"sync" | |
"time" | |
) | |
type ReadMode interface { |