Skip to content

Instantly share code, notes, and snippets.

View uuklanger's full-sized avatar

uuklanger

View GitHub Profile
@uuklanger
uuklanger / Get SQL Server TZ
Last active August 23, 2017 18:53
Determine the timezone of the SQL Server
DECLARE @TimeZone VARCHAR(50)
EXEC MASTER.dbo.xp_regread 'HKEY_LOCAL_MACHINE',
'SYSTEM\CurrentControlSet\Control\TimeZoneInformation',
'TimeZoneKeyName',@TimeZone OUT
SELECT @TimeZone
-- OR this snippet but I am not sure I trust it yet....
DECLARE @TZ SMALLINT
SELECT @TZ=DATEPART(TZ, SYSDATETIMEOFFSET())
set TARGET_IP=78.24.135.113
set NETWORK_INTERFACE_IP=10.100.197.60
route add %TARGET_IP% mask 255.255.255.255 %NETWORK_INTERFACE_IP% metric 2
@uuklanger
uuklanger / K810_Bluetooth
Created December 14, 2017 02:34
Setup Bluetooth Keyboard on Linux Ubuntu - K810
root@rapunzel:~# bluetoothctl -a
[NEW] Controller 74:F0:6D:EA:D2:14 rapunzel [default]
[NEW] Device 00:1F:20:91:C7:8C Logitech K810
Agent registered
[Logitech K810]# remove 00:1F:20:91:C7:8C
[CHG] Device 00:1F:20:91:C7:8C ServicesResolved: no
Device has been removed
[CHG] Device 00:1F:20:91:C7:8C Connected: no
[DEL] Device 00:1F:20:91:C7:8C Logitech K810
[bluetooth]# scan on
@uuklanger
uuklanger / Get DB Restore History
Created January 12, 2018 20:43
This script will provide information on the last DB restore.
DECLARE @dbname sysname, @days int
SET @dbname = NULL --substitute for whatever database name you want
SET @days = -50 --previous number of days, script will default to 30
SELECT
rsh.destination_database_name AS [Database],
rsh.user_name AS [Restored By],
CASE WHEN rsh.restore_type = 'D' THEN 'Database'
WHEN rsh.restore_type = 'F' THEN 'File'
WHEN rsh.restore_type = 'G' THEN 'Filegroup'
WHEN rsh.restore_type = 'I' THEN 'Differential'
@uuklanger
uuklanger / tomcat_response_compression.txt
Created February 1, 2018 20:21
Turn On Tomcat Compression
<Connector port="8080" maxHttpHeaderSize="8192"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true"
compression="on"
compressionMinSize="1024"
noCompressionUserAgents="gozilla, traviata"
compressableMimeType="text/html,text/xml"/>
@uuklanger
uuklanger / google_calendar_sync
Created June 2, 2018 19:12
Google Calendar Sync
If you sync a calendar from a team or group and you want to sync it to google calendar do the following
1. From a browser go to google calenar and add the new calendar via URL (most likely)
2. Save and ensure you see some events from that team / group.
3. Now you want to see it on your iPhone/iPad
a. Go to https://calendar.google.com/calendar/syncselect
b. Check the calendar by name in the list you want to see on your mobile apps.
c. Save
4. Go to your phone or iPad and look at your calendar. You should see the new calendar populate within a few minutes.
@uuklanger
uuklanger / cmdkey.exe
Created November 6, 2018 22:28
HOWTO: View Cached Passwords in Windows 10 using built in command
C:\Users\k.langer>cmdkey
Creates, displays, and deletes stored user names and passwords.
The syntax of this command is:
CMDKEY [{/add | /generic}:targetname {/smartcard | /user:username {/pass{:password}}} | /delete{:targetname | /ras} | /list{:targetname}]
Examples:
@uuklanger
uuklanger / event_log_40960.ps1
Created November 7, 2018 19:16
Query the Windows 10 Event Log for any instance id of 40960
Get-EventLog -LogName "System" -Newest 100 -InstanceId 40960
write-host "Press any key to continue..."
[void][System.Console]::ReadKey($true)
@uuklanger
uuklanger / MakeGitKrakenSSHKEY.sh
Last active January 21, 2022 18:13
HOWTO: Create a ssh RSA Key compatible with GITKRAKEN
$ ssh-keygen -t rsa -m PEM -b 4096 -C "mylogin@HOST"
OR the modern way
$ ssh-keygen -t ed25519 -C "[email protected]"
@uuklanger
uuklanger / fake_await_call.snippet
Created October 3, 2019 15:42
HOWTO - Fake await Calls in async Testing Code to avoid Compiler Warnings for Methods that have Nothing awaitable
// Official Microsoft Way
await Task.CompletedTask;
// Alternate Way
await Task.Delay(0);