Skip to content

Instantly share code, notes, and snippets.

View thiagosanches's full-sized avatar
🏠
Working from home

Thiago Sanches thiagosanches

🏠
Working from home
View GitHub Profile
#!/usr/bin/env python
"""
pip install tiktoken requests
export OPENAI_API_KEY=<redact>
chmod +x prepare-commit-msg
mv prepare-commit-msg .git/hooks/
"""
import math
@hyperupcall
hyperupcall / settings.jsonc
Last active May 13, 2024 22:21
VSCode config to disable popular extensions' annoyances (telemetry, notifications, welcome pages, etc.)
// I'm tired of extensions that automatically:
// - show welcome pages / walkthroughs
// - show release notes
// - send telemetry
// - recommend things
//
// This disables all of that stuff.
// If you have more config, leave a comment so I can add it!!
{
@alfeugds
alfeugds / README.md
Last active September 25, 2023 14:19
AutoHotkey - Media keyboard shortcuts

AutoHotkey - Media keyboard shortcuts

Control media with easy to remember keyboard shortcuts.

Even if you have a keyboard with dedicated media buttons, you'll find these keyboard shortcuts a lot easier to control the media on your computer.

  • Alt + Shift + Space : Pause/Play
  • Alt + Shift + n : Next
  • Alt + Shift + p : Previous
  • Alt + Shift + m : Mute
  • Alt + Shift + + : Volume up
@atheiman
atheiman / User_Data.md
Last active March 21, 2024 21:15
EC2 User Data examples for Windows and Linux

EC2 User Data examples

Basic Windows local user with Administrator and RDP access

Add a local rdp user via user data at launch of a Windows EC2 instance. Note that this includes a password passed in thru both the user data and powershell command line and is a bad security practice because they can be viewed later. At a minimum, you should connect to the instance immediately after launch and change the password interactively. Also, delete the userdata from the instance after launch. More secure would be to connect the instance to a domain for authentication or use AWS native tooling to connect to the instance (e.g., AWS Session Manager).

<powershell>
# Be sure to set the username and password on these two lines. Of course this is not a good
# security practice to include a password at command line.
@yangvipguang
yangvipguang / Vimrc-example
Created January 16, 2020 06:26
Vimrc-example
scriptencoding utf-8
" ============================================================================
" Author: yangguang
" Version: v1.1.0
" Update Time: 2020-01-01
" ============================================================================
" Vundle initialization
" Avoid modify this section, unless you are very sure of what you are doing
@manuelbl
manuelbl / README.md
Created August 3, 2019 09:12
ESP32 as Bluetooth Keyboard

ESP32 as Bluetooth Keyboard

With its built-in Bluetooth capabilities, the ESP32 can act as a Bluetooth keyboard. The below code is a minimal example of how to achieve it. It will generate the key strokes for a message whenever a button attached to the ESP32 is pressed.

For the example setup, a momentary button should be connected to pin 2 and to ground. Pin 2 will be configured as an input with pull-up.

In order to receive the message, add the ESP32 as a Bluetooth keyboard of your computer or mobile phone:

  1. Go to your computers/phones settings
  2. Ensure Bluetooth is turned on
@caseyamcl
caseyamcl / pw
Last active March 1, 2021 13:44
Linux CLI Password Generator
#!/bin/bash
#
# Need to generate passwords frequently on the Linux CLI?
#
# This script creates a password and copies it to the clipboard.
#
# 1. Ensure you have 'pwgen' and 'xclip' installed
# (sudo apt-get install pwgen xclip)
# 2. Download this script and make it executable:
# (sudo wget -O /usr/bin/pw https://gist.githubusercontent.com/caseyamcl/53f0c91e9ef1b42abb57/raw/pw && sudo chmod 755 /usr/bin/pw)
@alanwill
alanwill / aws-cfn-self-referencing-sg.json
Last active January 18, 2024 17:00
AWS CloudFormation example that allows a security group rule to reference the same security group as the source.
{
"Description": "Create a VPC with a SG which references itself",
"AWSTemplateFormatVersion": "2010-09-09",
"Resources": {
"vpctester": {
"Type": "AWS::EC2::VPC",
"Properties": {
"CidrBlock": "172.16.0.0/23",
"EnableDnsSupport": false,
"EnableDnsHostnames": false,