Skip to content

Instantly share code, notes, and snippets.

View jcrqr's full-sized avatar
🎯
Focusing

João Cerqueira jcrqr

🎯
Focusing
View GitHub Profile
@mitchellh
mitchellh / merge_vs_rebase_vs_squash.md
Last active March 18, 2025 21:32
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:

@pahud
pahud / bootstrap.sh
Last active September 27, 2024 14:27
AWS SSO + Codespaces
#!/bin/bash
# video demo - https://www.youtube.com/watch?v=Y8TyE_DNds8
mkdir ~/.tmp && cd $_
# install aws-cli v2
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && \
unzip awscliv2.zip && \
sudo ./aws/install
@ClickerMonkey
ClickerMonkey / types.ts
Last active August 8, 2024 00:25
Typescript Helper Types
// when T is any|unknown, Y is returned, otherwise N
type IsAnyUnknown<T, Y, N> = unknown extends T ? Y : N;
// when T is never, Y is returned, otherwise N
type IsNever<T, Y = true, N = false> = [T] extends [never] ? Y : N;
// when T is a tuple, Y is returned, otherwise N
// valid tuples = [string], [string, boolean],
// invalid tuples = [], string[], (string | number)[]
@kaznak
kaznak / configuration.nix
Last active December 14, 2023 08:01
NixOS configuration for AWS EC2 instance
{ modulesPath, pkgs, lib, ... }: {
imports = [
"${modulesPath}/virtualisation/amazon-image.nix"
];
ec2.hvm = true;
################################################
system.autoUpgrade = {
enable = true;
allowReboot = true;
@hjertnes
hjertnes / doom.txt
Created April 6, 2018 08:28
Doom Emacs Cheatsheet
SPC
SPC: find file
, switch buffer
. browse files
: MX
; EX
< switch buffer
` eval
u universal arg
x pop up scratch
@posener
posener / go-shebang-story.md
Last active March 15, 2025 16:08
Story: Writing Scripts with Go

Story: Writing Scripts with Go

This is a story about how I tried to use Go for scripting. In this story, I’ll discuss the need for a Go script, how we would expect it to behave and the possible implementations; During the discussion I’ll deep dive to scripts, shells, and shebangs. Finally, we’ll discuss solutions that will make Go scripts work.

Why Go is good for scripting?

While python and bash are popular scripting languages, C, C++ and Java are not used for scripts at all, and some languages are somewhere in between.

@auser
auser / Dockerfile
Created May 13, 2017 22:08
Dockerfile for elixir development
FROM elixir:1.4.2
ENV PORT=4000 MIX_ENV=prod
ENV APP_NAME=myapp APP_VERSION="0.1.0"
RUN mix local.hex --force && \
mix local.rebar --force && \
mkdir /build
WORKDIR /build
@0xjac
0xjac / private_fork.md
Last active April 22, 2025 11:01
Create a private fork of a public repository

The repository for the assignment is public and Github does not allow the creation of private forks for public repositories.

The correct way of creating a private frok by duplicating the repo is documented here.

For this assignment the commands are:

  1. Create a bare clone of the repository. (This is temporary and will be removed so just do it wherever.)

git clone --bare [email protected]:usi-systems/easytrace.git

@jagrosh
jagrosh / Github Webhook Tutorial.md
Last active April 22, 2025 14:04
Simple Github -> Discord webhook

Step 1 - Make a Discord Webhook

  1. Find the Discord channel in which you would like to send commits and other updates

  2. In the settings for that channel, find the Webhooks option and create a new webhook. Note: Do NOT give this URL out to the public. Anyone or service can post messages to this channel, without even needing to be in the server. Keep it safe! WebhookDiscord

Step 2 - Set up the webhook on Github

  1. Navigate to your repository on Github, and open the Settings Settings
@ku1ik
ku1ik / web-controllers-doc_controller.ex
Last active June 24, 2017 16:19
Nested layouts in Phoenix
defmodule Asciinema.DocController do
use Asciinema.Web, :controller
def show(conn, _params) do
conn
|> put_layout(:docs)
|> render("show.html")
end
end