Skip to content

Instantly share code, notes, and snippets.

@jonlabelle
jonlabelle / crlf.py
Last active March 12, 2024 05:44
Replace CRLF (windows) line endings with LF (unix) line endings in files.
#!/usr/bin/env python
"""Replace line breaks, from one format to another."""
from __future__ import print_function
import argparse
import glob
import os
import sys
@martinlindenberg
martinlindenberg / format-aws-sso.js
Last active June 6, 2023 13:04
reformats AWS sso page. (greasemonkey script)
// ==UserScript==
// @name format-aws-sso
// @namespace signin.aws.amazon.com
// @description reformats that page
// @include https://signin.aws.amazon.com/saml
// @version 1.1
// @grant none
// ==/UserScript==
$('#saml_form').css('max-width', 'none');
$('fieldset').css('width', 'none');
@asukakenji
asukakenji / 0-go-os-arch.md
Last active April 24, 2024 06:51
Go (Golang) GOOS and GOARCH

Go (Golang) GOOS and GOARCH

All of the following information is based on go version go1.17.1 darwin/amd64.

GOOS Values

GOOS Out of the Box
aix
android
@rodricels
rodricels / .tmux.conf
Last active April 21, 2024 12:22
tmux configuration, mouse copy & paste added
# My tmux configuration, partly based on https://github.com/wbkang/wbk-stow/blob/master/tmux-config/.tmux.conf
# Scroll History
set -g history-limit 50000
# show messages for 4 seconds instead
set -g display-time 4000
# set first window to index 1 (not 0) to map more to the keyboard layout
set-option -g renumber-windows on
@Blake-
Blake- / gist:fc00725d519a25a55b3c2368d1ee238d
Created October 21, 2017 01:10
Mounting a s3ql file system to the S3 compatible file system at Softlayer on an Ubuntu 16 Xenial VSI
Mounting a s3ql file system to the S3 compatible file system at Softlayer on an Ubuntu 16 Xenial VSI
apt install s3ql
nano /etc/s3ql.authinfo
[softlayer-s3]
backend-login: somelogin
@ajdruff
ajdruff / fix-git-line-endings
Last active February 29, 2024 13:02
Forces all line endings to LF in your git repo.
#####################
#
# Use this with or without the .gitattributes snippet with this Gist
# create a fixle.sh file, paste this in and run it.
# Why do you want this ? Because Git will see diffs between files shared between Linux and Windows due to differences in line ending handling ( Windows uses CRLF and Unix LF)
# This Gist normalizes handling by forcing everything to use Unix style.
#####################
# Fix Line Endings - Force All Line Endings to LF and Not Windows Default CR or CRLF
@rivo
rivo / postgres.go
Last active August 6, 2023 22:39
A demo Go application (a PostgreSQL database browser) highlighting the use of the rivo/tview package. See https://github.com/rivo/tview/wiki/Postgres
package main
import (
"database/sql"
"fmt"
"net/url"
"os"
"reflect"
"regexp"
"strconv"
@rszeto
rszeto / *pycharm-setup-2020.3.2.md
Last active March 31, 2024 07:28
Setting up PyCharm project with remote interpreter

Setting up PyCharm project with remote interpreter

Setting up a remote interpreter on PyCharm is awfully unintuitive. I've pared it down to what I think is the minimal number of steps, and leaves the fewest number of deployment configurations and Python interpreters lying around. This is designed for my specific configuration (specifically PyTorch); adapt as needed.

Configuring default project (only do after installing PyCharm for the first time):

  1. (Optional) Add virtual environment path to excluded files
    1. From Welcome Page, go to Configure > Settings > Build, Execution, Deployment > Deployment > Options
    2. Add virtualenv path. For example, if you always have the project's virtualenv in .env, add ";.env" to the "Exclude items by name" field
@markekraus
markekraus / GetInboxRuleReport.ps1
Last active January 31, 2019 18:33
Generates Multi-Threaded Office 365 Inbox Rule Report That Scales with the Number of Service Accounts Provided
using namespace System.Collections.Concurrent
$StartDate = [datetime]::UtcNow
# can be generated with something like
# 1..10 | %{ Get-Credential} | Export-CliXml -path 'C:\reports\InboxRules\Creds.xml'
# Which will prompt for credentials 10 times and store them in the xml file
$CredentialFile = 'C:\reports\InboxRules\Creds.xml'
$RunDate = $StartDate.ToString('o') -replace ':'
# This is the path of the CSV file. It is imperative that this file not be
# access while the script is running
@miguelmota
miguelmota / rsa_util.go
Last active April 21, 2024 15:10
Golang RSA encrypt and decrypt example
package ciphers
import (
"crypto/rand"
"crypto/rsa"
"crypto/sha512"
"crypto/x509"
"encoding/pem"
"log"
)