Skip to content

Instantly share code, notes, and snippets.

View Mikuana's full-sized avatar

Christopher Boyd Mikuana

View GitHub Profile
#!/usr/bin/env python3
"""
Use the speedtest-cli package to perform a test of internet speeds, and log the
result to file. The results are broken up by month and stored in a folder named
`speed_tests`, unless you supply an alternate path in the first command line
argument.
```
python3 speed_testing.py /var/logs/my_speed_folder
```
@Mikuana
Mikuana / fix_gnome_tty.sh
Created October 15, 2017 23:58
Fix Super/Alt + Arrow behavior in GNOME
# from https://bugs.launchpad.net/ubuntu/+source/gnome-shell/+bug/1508146
sudo kbd_mode -s
### Keybase proof
I hereby claim:
* I am mikuana on github.
* I am mikuana (https://keybase.io/mikuana) on keybase.
* I have a public key ASCWi6rkC2M0FUAm7D9Jx0KL_RLwFN0dSm7qbY3uwJs6mAo
To claim this, I am signing this object:
@Mikuana
Mikuana / gist:de5eb835eb032904b44e1e7869d795c0
Created March 27, 2017 12:09
Teradata JDBC URL for use in PyCharm data connection
jdbc:teradata://{host::localhost}/[\?<&,user={user},password={password},database={database}>]
@Mikuana
Mikuana / remove_user_packages.R
Created March 2, 2017 00:31
Remove all user installed packages from R
# Shamlessly stolen from:
# https://www.r-bloggers.com/how-to-remove-all-user-installed-packages-in-r/
# create a list of all installed packages
ip <- as.data.frame(installed.packages())
head(ip)
# if you use MRO, make sure that no packages in this library will be removed
ip <- subset(ip, !grepl("MRO", ip$LibPath))
# we don't want to remove base or recommended packages either\
ip <- ip[!(ip[,"Priority"] %in% c("base", "recommended")),]
@Mikuana
Mikuana / TSQL_calendar_generation.sql
Created February 6, 2017 20:35
Generate a TSQL calendar table using all_objects table as a seed
DECLARE
@cal_start DATE
, @cal_end DATE
, @n INT
;
SELECT
@cal_start = '1970-01-01'
, @cal_end = '2030-12-31'
, @n = DATEDIFF(DAY, @cal_start, @cal_end)
SELECT
dept_id AS dept_id
, 1 AS hours_id
, hours1 AS hours
FROM
hours_table t
WHERE
hours1 IS NOT NULL
UNION ALL
@Mikuana
Mikuana / teradata-sql.yml
Last active April 16, 2019 09:45
Sublime Text 3 syntax definition for Teradata SQL
%YAML 1.2
---
# To enable the syntax in Sublime Text, you must save this as a file under `%APPDATA%\Sublime Text 3\Packages\User\teradata-sql.sublime-syntax`
# Script was copied from the standard SQL syntax included in Sublime Text 3, then modified to suit.
name: Teradata SQL
file_extensions:
- sql
scope: source.sql
contexts:
main:
@Mikuana
Mikuana / print_full_panda.py
Created February 14, 2016 21:28
Adjust max rows in pandas pretty print for one time call
import pandas as pd
def print_full(x):
pd.set_option('display.max_rows', len(x))
print(x)
pd.reset_option('display.max_rows')
@Mikuana
Mikuana / ExportDatabase.vba
Created December 22, 2015 05:20
Export all tables in a Microsoft Access database to text
Option Compare Database
Public Sub ExportAll()
Dim obj As AccessObject, dbs As Object
Set dbs = Application.CurrentData
For Each obj In dbs.AllTables
If Left(obj.Name, 4) <> "MSys" Then
DoCmd.TransferText acExportDelim, , obj.Name, obj.Name & ".csv", True
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, obj.Name, obj.Name & ".xls", True
End If
Next obj