Skip to content

Instantly share code, notes, and snippets.

View bradkrane's full-sized avatar

Brad Krane bradkrane

  • Waterloo, Ontario
View GitHub Profile
@bradkrane
bradkrane / country-code-to-currency-code-mapping.csv
Created February 24, 2019 23:13 — forked from borismacias/country-code-to-currency-code-mapping.csv
Country, Country Code, Currency code mapping in CSV format Taken from https://gist.github.com/304261 Contains 249 countries.
Country CountryCode Currency Code
New Zealand NZ New Zealand Dollars NZD
Cook Islands CK New Zealand Dollars NZD
Niue NU New Zealand Dollars NZD
Pitcairn PN New Zealand Dollars NZD
Tokelau TK New Zealand Dollars NZD
Australian AU Australian Dollars AUD
Christmas Island CX Australian Dollars AUD
Cocos (Keeling) Islands CC Australian Dollars AUD
Heard and Mc Donald Islands HM Australian Dollars AUD
@bradkrane
bradkrane / 12\data\pg_hba.conf
Last active October 30, 2019 19:24
PSQL no Auth Local Users
# PostgreSQL Client Authentication Configuration File
# ===================================================
#
# Refer to the "Client Authentication" section in the PostgreSQL
# documentation for a complete description of this file. A short
# synopsis follows.
#
# This file controls: which hosts are allowed to connect, how clients
# are authenticated, which PostgreSQL user names they can use, which
# databases they can access. Records take one of these forms:
#hostname:port:database:username:password
localhost:5432:postgres:postgres:01234567989
@bradkrane
bradkrane / pgsql-cmd-line.md
Last active October 2, 2020 17:03
Setup psql 12.0 on Windows 10 - No password localhost windows users

Setup psql 12.0 on Windows 10

  • No password localhost windows users
  • Usefull for on the command line: type <some_file>.psql | psql
  • Windows Binary 12.X as of writing https://www.postgresql.org/download/
  • Remember the postgress password for the step when opening pgAdmin later

Default install path: C:\Program Files\PostgreSQL\12\

Add pgsql path to command line

@bradkrane
bradkrane / make-devenv.sh
Created November 6, 2019 12:36
Quick DevEnv Debian 9.8 CAC-Deploy
#Roll then connect to VM
passwd # always change root
apt update
apt install aptitude
aptitude # install security updates
apt install fail2ban firehol unattended-upgrades apt-listchanges sudo
apt install postgres ruby git emacs
adduser brad
@bradkrane
bradkrane / odt2txt.cmd.md
Last active April 27, 2024 01:46
Git diff for LibreOffice ODT files for Windows Setup

Batch Script and Git Setup for text diff of ODT files with LibreOffice

git Windows will diff docx files without any additional configuration but surprisingly, this is not the case for ODT files. This simple Window shell script and git attributes configuration allows for diffing ODT files with LibreOffice

Windows Shell Script

Copy the script below locally, I use %USERPROFILE%\scripts as the reference destination in the Configure Git section below, but you can choose whatever you want replacing the path with your own throughout the document.

Waring: this script assumes that the there is no .txt file that matches the filename less extension of the ODT file being diffed. This is a temporary work around for the --cat option of soffice.exe not working as advertized. Bug 129713

@bradkrane
bradkrane / shopify-country-region.rb
Created February 19, 2020 03:42
Shopify Country Code to Region Mapping
regions = {
AF: 'Africa',
AS: 'Asia',
CA: 'Central America',
EU: 'European Union',
NA: 'North America',
OC: 'Oceania',
OT: 'Other',
SA: 'South America',
AN: 'Antarctica',
REM This is to fix teams issue: MS Teams keeps randomly crashing
REM https://answers.microsoft.com/en-us/msoffice/forum/all/ms-teams-keeps-randomly-crashing/d4b3fd90-c77e-468a-82a7-8190db44f73f
taskkill /F /IM teams.exe
del /f /s /q %appdata%\Microsoft\teams\application cache\cache\*
del /f /s /q %appdata%\Microsoft\teams\blob_storage\*
del /f /s /q %appdata%\Microsoft\teams\databases\*
del /f /s /q %appdata%\Microsoft\teams\GPUcache\*
del /f /s /q %appdata%\Microsoft\teams\IndexedDB\*
del /f /s /q "%appdata%\Microsoft\teams\Local Storage\*"
@bradkrane
bradkrane / preventAdditionalMouseEvent.html
Created August 20, 2020 01:07 — forked from toruta39/preventAdditionalMouseEvent.html
Prevent mouseout/mouseover event triggered when moving onto/from a child element
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Prevent additional mouse event</title>
</head>
<body>
<div id="ele" style="width: 300px; height: 300px; background-color: #0FF;">
This is the parent element.
<div style="width: 200px; height: 200px; background-color: #FFF;">
@bradkrane
bradkrane / dynamic-timeanddate.js
Last active April 5, 2021 02:10
Dynamic DateTime www.timeanddate.com Bookmarklet
javascript:(() => {
const pad = (x) => { if(x < 10){ return x = '0' + x } return x };
let now = new Date();
let y = now.getFullYear();
let mo = pad(now.getMonth() +1);
let d = pad(now.getDate());
let h = pad(now.getUTCHours());
now = `${y}${mo}${d}`;
window.location.replace(`https://www.timeanddate.com/worldclock/converter.html?iso=${now}T${h}0000&p1=137&p2=55&p3=250&p4=136&p5=48&p6=56&p7=214&p8=240`);