Skip to content

Instantly share code, notes, and snippets.

View Rican7's full-sized avatar
😮
My dotfiles just keep getting better... and its been OVER 10 YEARS NOW! ⌚😮🤯

Trevor N. Suarez Rican7

😮
My dotfiles just keep getting better... and its been OVER 10 YEARS NOW! ⌚😮🤯
View GitHub Profile
@chase-moskal
chase-moskal / promise-all-keys.ts
Last active July 22, 2024 09:12
Typescript function to await all promised object properties
type Unpacked<T> =
T extends (infer U)[]
? U
: T extends (...args: any[]) => infer U
? U
: T extends Promise<infer U>
? U
: T
@michaelboke
michaelboke / Dockerfile
Last active April 24, 2025 15:28
Docker scratch x509 fix
FROM golang:alpine as builder
WORKDIR /app
#the following 2 steps are optional if your image does not already have the certificate
# package installed, golang:alpine now seems to have it. But a more base image could be missing it.
#RUN apk update && apk upgrade && apk add --no-cache ca-certificates
#RUN update-ca-certificates
ADD main.go /app/main.go
RUN CGO_ENABLED=0 GOOS=linux go build -a -ldflags="-s -w" -installsuffix cgo -o app .
FROM scratch
@jamesfreeman959
jamesfreeman959 / keepawake.ps1
Last active May 5, 2025 06:41
A very simple PowerShell script to keep a Windows PC awake and make lync think the user is active on the keyboard
# Useful references:
#
# https://superuser.com/questions/992511/emulate-a-keyboard-button-via-the-command-line
# https://ss64.com/vb/sendkeys.html
# https://social.technet.microsoft.com/Forums/windowsserver/en-US/96b339e2-e9da-4802-a66d-be619aeb21ac/execute-function-one-time-in-every-10-mins-in-windows-powershell?forum=winserverpowershell
# https://learn-powershell.net/2013/02/08/powershell-and-events-object-events/
#
# Future enhancements - use events rather than an infinite loop
$wsh = New-Object -ComObject WScript.Shell
while (1) {
@Rican7
Rican7 / Enable Import Photos and Videos.bat
Created October 16, 2017 17:13
Enable the old style (Win 7) "Import pictures and videos" AutoPlay option for Windows 10
cd "C:\Program Files (x86)\Windows Photo Viewer"
regsvr32 PhotoAcq.dll
regsvr32 PhotoViewer.dll
@romainl
romainl / colorscheme-override.md
Last active March 8, 2025 21:23
The right way to override any highlighting if you don't want to edit the colorscheme file directly

The right way to override any highlighting if you don't want to edit the colorscheme file directly

Generalities first

Suppose you have weird taste and you absolutely want:

  • your visual selection to always have a green background and black foreground,
  • your active statusline to always have a white background and red foreground,
  • your very own deep blue background.
@Rican7
Rican7 / label-github-emails-in-gmail.gs
Last active October 20, 2020 06:31
Filters Gmail message threads to apply helpful GitHub labels, for organization.
/**
* Labels Gmail email threads
*/
function labelGithubEmails() {
/**
* Gmail label names for GitHub messages
*/
const githubLabelName = 'GitHub'
const githubPullRequestLabelName = 'GitHub/Pull Request'
const githubIssueLabelName = 'GitHub/Issue'
@atoponce
atoponce / gist:07d8d4c833873be2f68c34f9afc5a78a
Last active April 25, 2025 13:56 — forked from tqbf/gist:be58d2d39690c3b366ad
Cryptographic Best Practices

Cryptographic Best Practices

Putting cryptographic primitives together is a lot like putting a jigsaw puzzle together, where all the pieces are cut exactly the same way, but there is only one correct solution. Thankfully, there are some projects out there that are working hard to make sure developers are getting it right.

The following advice comes from years of research from leading security researchers, developers, and cryptographers. This Gist was [forked from Thomas Ptacek's Gist][1] to be more readable. Additions have been added from

@epixoip
epixoip / 8x1080.md
Last active November 3, 2024 15:42
8x Nvidia GTX 1080 Hashcat Benchmarks
@taylorotwell
taylorotwell / gist:68f614deb9538f2e30108c2698266fda
Last active May 28, 2020 08:41
ADR out of the box for Brandon
<?php
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
@Rican7
Rican7 / get-mysql-database-size-meta.sql
Created April 27, 2016 16:14
Query MySQL database size meta
# Get the size meta of every accessible schema
SELECT
count(*) tables,
`table_schema`,
format(sum(`table_rows`)/1000000, 3) `rows (M)`,
format(sum(`data_length`)/(1024*1024*1024), 3) `data_size (GB)`,
format(sum(`index_length`)/(1024*1024*1024), 3) `index_size (GB)`,
format((sum(`data_length`+`index_length`))/(1024*1024*1024), 3) `total_size (GB)`,
format(sum(`index_length`)/sum(`data_length`), 3) `index_data_ratio`
FROM