Skip to content

Instantly share code, notes, and snippets.

View eestrada's full-sized avatar

Ethan Estrada eestrada

View GitHub Profile
@mitchellh
mitchellh / merge_vs_rebase_vs_squash.md
Last active April 22, 2024 16:22
Merge vs. Rebase vs. Squash

I get asked pretty regularly what my opinion is on merge commits vs rebasing vs squashing. I've typed up this response so many times that I've decided to just put it in a gist so I can reference it whenever it comes up again.

I use merge, squash, rebase all situationally. I believe they all have their merits but their usage depends on the context. I think anyone who says any particular strategy is the right answer 100% of the time is wrong, but I think there is considerable acceptable leeway in when you use each. What follows is my personal and professional opinion:

@senko
senko / hey-gpt
Created March 29, 2023 17:52
Small bash script to use ChatGPT from command line
#!/bin/bash
if test -z "$1"; then
echo "Usage: $0 <prompt>"
exit 1
fi
if test -z "$OPENAI_API_KEY"; then
echo "OpenAI key is missing - \$OPENAI_API_KEY must be set"
exit 1
@jthodge
jthodge / universal-switcher
Created September 6, 2020 22:07
Show macOS app switcher across all monitors
defaults write com.apple.Dock appswitcher-all-displays -bool true
killall Dock
@YumaInaura
YumaInaura / VIMIUM.md
Last active April 21, 2024 22:56
Vimium — Default keymap list used to Custom key mappings ( unmapAll and enable mappings you like )

Vimium — Default keymap list used to Custom key mappings

Shortcuts

# Navigating the page

map j scrollDown
map <c-e> scrollDown
map k scrollUp
@101v
101v / NatualScrollingInWindows.ps1
Created January 18, 2017 21:19
Powershell script to enable natural scrolling in Windows
# View registry settings
Get-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Enum\HID\*\*\Device` Parameters FlipFlopWheel -EA 0
# Change registry settings
# Reverse mouse wheel scroll FlipFlopWheel = 1
# Normal mouse wheel scroll FlipFlopWheel = 0
Get-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Enum\HID\*\*\Device` Parameters FlipFlopWheel -EA 0 | ForEach-Object { Set-ItemProperty $_.PSPath FlipFlopWheel 1 }
# Restore default scroll direction
# Get-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Enum\HID\*\*\Device` Parameters FlipFlopWheel -EA 1 | ForEach-Object { Set-ItemProperty $_.PSPath FlipFlopWheel 0 }
@etscrivner
etscrivner / picture-language.rkt
Created May 27, 2015 05:43
Complete racket source code for playing with the SICP picture language.
#lang racket/gui
(require graphics/graphics)
(open-graphics)
(define vp (open-viewport "A Picture Language" 500 500))
(define draw (draw-viewport vp))
(define (clear) ((clear-viewport vp)))
(define line (draw-line vp))
(define (make-vect x y)
@tschieggm
tschieggm / flask_server.py
Created November 22, 2013 18:51
Stackdriver webhook server example
import string
import sys
import logging
import json
from flask import Flask
from flask import Response, request
logger = logging.getLogger(__name__)
logger.info("Stackdriver webhook-sample starting up on %s" % (string.replace(sys.version, '\n', ' ')))
@mattconnolly
mattconnolly / gist:4158961
Created November 28, 2012 04:04
RSpec basic authentication helper module for request and controller specs
module AuthHelper
def http_login
user = 'username'
pw = 'password'
request.env['HTTP_AUTHORIZATION'] = ActionController::HttpAuthentication::Basic.encode_credentials(user,pw)
end
end
module AuthRequestHelper
#
@pettyjamesm
pettyjamesm / semaphore.rb
Created September 18, 2012 22:40
Ruby Semaphore Implementation
require 'monitor'
class Semaphore
def initialize(maxval = nil)
maxval = maxval.to_i unless maxval.nil?
raise ArgumentError.new("Semaphores must use a positive maximum value or have no maximum!") if maxval and maxval <= 0
@max = maxval || -1
@count = 0
@mon = Monitor.new
@dwait = @mon.new_cond
@uwait = @mon.new_cond
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active April 25, 2024 06:23
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname