Skip to content

Instantly share code, notes, and snippets.

View uuklanger's full-sized avatar

uuklanger

View GitHub Profile
@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 / 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 / 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
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 / 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())
@uuklanger
uuklanger / python_tk_text_box_with_colors.py
Created June 16, 2017 17:01
Sample code that shows how to use multiple colors within a Text TK box. This is in the form of a console
from tkinter import *
root = Tk()
text = Text(root, wrap=NONE, bg="black", fg="lightgreen", font=("Consolas", 10, "normal"))
BG_EVEN = 'BG_EVEN'
BG_ODD = 'BG_ODD'
text.tag_config('FG_FATAL', foreground='yellow', background='red')
text.tag_config('FG_ERROR', foreground='orange')
@uuklanger
uuklanger / gist:6f1100a57b4e5bd683c098f496167007
Created May 26, 2017 16:47
Turn off Touchpad while typing
Name: Syndaemon
Commaond: syndaemon -i 1.0 -K -R -t
Descriptiong: Turn off trackpad while typing for Ubuntu/XBuntu
@uuklanger
uuklanger / pyodbc_drivers.py
Created April 28, 2017 16:31
Code for determining what ODBC datasources are available
#!/usr/bin/env python3
# -*- coding: utf8 -*-
import pypyodbc
def show_odbc_sources():
odbc_list = []
for d in pypyodbc.drivers():
odbc_list.append('%s' % (d))
@uuklanger
uuklanger / Rename files to be all lowercase
Last active January 9, 2017 19:11
Rename files to be all lowercase
# Take a listing of files and renames to be lowercase. The ls -1 is the selector of which files are impacted so be careful.
for f in `ls -1`; do mv -v "$f" "`echo $f | tr '[A-Z]' '[a-z]'`"; done
@uuklanger
uuklanger / XFCE4 Reverse Scroll Fix
Created January 5, 2017 22:12
Correct the scrolling in XFCE4 to be Natural Scrolling
synclient
synclient VertScrollDelta=-58
synclient HorizScrollDelta=-58