This file contains hidden or 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
rem Australian Date format | |
reg add "HKCU\Control Panel\International" /v sShortDate /t REG_SZ /d "dd/MM/yyyy" /f | |
reg add "HKCU\Control Panel\International" /v sCountry /t REG_SZ /d "Australia" /f |
This file contains hidden or 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
rem Proxy settings | |
rem Substitute your own proxy server and exclusion list | |
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 1 /f | |
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /t REG_SZ /d my-proxy-server.my-domain.com:3128 /f | |
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyOverride /t REG_SZ /d "192.168.1.*;10.5.1.*;<local>" /f | |
netsh winhttp set proxy my-proxy-server.my-domain.com:3128 |
This file contains hidden or 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
$PrintServer = "\\old_print_server" | |
$Printers = Get-WmiObject -Class Win32_Printer | |
ForEach ($Printer in $Printers) { | |
If ($Printer.SystemName -like "$PrintServer") { | |
(New-Object -ComObject WScript.Network).RemovePrinterConnection($($Printer.Name)) | |
} | |
} |
This file contains hidden or 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
def fibonacci(n): | |
if n < 2: | |
return n | |
return fibonacci(n-2) + fibonacci(n-1) |
This file contains hidden or 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
def isPalendrome(s): | |
return s == s[::-1] |
This file contains hidden or 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
#!/usr/bin/env python3 | |
""" Purge all items from an AWS dynamodb table with an exponential timing back-off | |
""" | |
import logging | |
from time import sleep | |
import boto3 | |
from botocore.exceptions import ClientError |
This file contains hidden or 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
#!/usr/bin/env python3 | |
""" Copy an AWS dynamodb table to an existing table with an exponential timing back-off | |
Assume receiving table has a compatible schema | |
""" | |
import logging | |
from time import sleep | |
import boto3 |
This file contains hidden or 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
#!/usr/bin/env python3 | |
""" Rename an AWS dynamodb table attribute with an exponential timing back-off | |
""" | |
import logging | |
from time import sleep | |
import boto3 | |
from boto3.dynamodb.conditions import Attr |
This file contains hidden or 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
def sum_of_digits(n): | |
s = 0 | |
while n > 0: | |
s += n % 10 | |
n /= 10 | |
return s |
This file contains hidden or 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
import datetime | |
def isDate(date_text, fmt): | |
try: | |
datetime.datetime.strptime(date_text, fmt) | |
except ValueError: | |
return False | |
return True |
NewerOlder