Skip to content

Instantly share code, notes, and snippets.

@BrennanBarker
BrennanBarker / shovelpass.py
Created November 19, 2020 19:38
look for an environment variable before using get pass
"""First check environment variables for a password, if not then use `getpass`.
You might set the environment variable ahead of time with (from a shell)::
read -s secret
export secret
"""
import os, getpass
@tanyuan
tanyuan / smart-caps-lock.md
Last active May 8, 2024 16:05
Smart Caps Lock: Remap Caps Lock to Control AND Escape

Smart Caps Lock: Remap to Control AND Escape (Linux, Mac, Windows)

Caps Lock 變成智慧的 Control 以及 Escape

  • 單獨輕按一下就是 Escape
  • 若按下時同時按著其他鍵,就會是 Control

這應該是 Vim 和 Emacs 的最佳解了!(Emacs? Bash 的快捷鍵就是 Emacs 系列的)

  • Send Escape if you tap Caps Lock alone.
@jonjack
jonjack / add-update-refresh-github-access-token-on-mac.md
Last active May 8, 2024 16:05
Adding & Updating GitHub Access Token on Mac

Using an Access Token for the first time

Follow the instructions on Github to Create an Access Token in Github

Configure Git to use the osxkeychain

By default, git credentials are not cached so you need to tell Git if you want to avoid having to provide them each time Github requires you to authenticate. On Mac, Git comes with an “osxkeychain” mode, which caches credentials in the secure keychain that’s attached to your system account.

You can tell Git you want to store credentials in the osxkeychain by running the following:-

@ruzickap
ruzickap / openwrt_transmission.sh
Last active May 8, 2024 16:04
OpenWrt Transmission
opkg install transmission-remote transmission-web
mkdir -p /data/torrents/torrents-completed /data/torrents/torrents-incomplete /data/torrents/torrents /data/torrents/config
uci set transmission.@transmission[-1].enabled=1
uci set transmission.@transmission[-1].config_dir=/data/torrents/config
uci set transmission.@transmission[-1].download_dir=/data/torrents/torrents-completed
uci set transmission.@transmission[-1].incomplete_dir_enabled=true
uci set transmission.@transmission[-1].incomplete_dir=/data/torrents/torrents-incomplete
uci set transmission.@transmission[-1].blocklist_enabled=1
Alpine.directive('typed', (el, { expression, modifiers }, { evaluateLater, effect, cleanup }) => {
const getStrings = evaluateLater(expression);
const modifierValue = (key, fallback) => {
if (-1 === modifiers.indexOf(key)) {
return fallback;
}
const value = modifiers[modifiers.indexOf(key) + 1];
@dvgodoy
dvgodoy / draw_neural_net.py
Last active May 8, 2024 16:02
Draw neural network diagram with Matplotlib
## Gist originally developed by @craffel and improved by @ljhuang2017
import matplotlib.pyplot as plt
import numpy as np
def draw_neural_net(ax, left, right, bottom, top, layer_sizes, coefs_, intercepts_, n_iter_, loss_):
'''
Draw a neural network cartoon using matplotilb.
:usage:
@LeviSnoot
LeviSnoot / discord-timestamps.md
Last active May 8, 2024 16:02
Discord Timestamp Syntax

Discord Timestamps

Discord timestamps can be useful for specifying a date/time across multiple users time zones. They work with the Unix Timestamp format and can be posted by regular users as well as bots and applications.

The Epoch Unix Time Stamp Converter is a good way to quickly generate a timestamp. For the examples below I will be using the Time Stamp of 1543392060, which represents November 28th, 2018 at 09:01:00 hours for my local time zone (GMT+0100 Central European Standard Time).

Formatting

Style Input Output (12-hour clock) Output (24-hour clock)
Default <t:1543392060> November 28, 2018 9:01 AM 28 November 2018 09:01
@igricart
igricart / debian_pkg.md
Last active May 8, 2024 16:01
Create a simple debian package

Having a simple debian package out of a Python script

Create a directory to store the debian folder

$ mkdir -p test_folder/DEBIAN

Create a control file inside debian folder

@rahularity
rahularity / work-with-multiple-github-accounts.md
Last active May 8, 2024 16:00
How To Work With Multiple Github Accounts on your PC

How To Work With Multiple Github Accounts on a single Machine

Let suppose I have two github accounts, https://github.com/rahul-office and https://github.com/rahul-personal. Now i want to setup my mac to easily talk to both the github accounts.

NOTE: This logic can be extended to more than two accounts also. :)

The setup can be done in 5 easy steps:

Steps:

  • Step 1 : Create SSH keys for all accounts
  • Step 2 : Add SSH keys to SSH Agent
@aamiaa
aamiaa / CompleteDiscordQuest.md
Last active May 8, 2024 15:59
Complete Recent Discord Quest

Complete Recent Discord Quest

Note

This no longer works in browser!

Note

This no longer works if you're alone in vc! Somebody else has to join you!

How to use this script:

  1. Accept the quest under User Settings -> Gift Inventory