Skip to content

Instantly share code, notes, and snippets.

@nathanl
nathanl / deadlock_demo.md
Created June 10, 2022 18:41
Demo of deadlocks with PostgreSQL
Rank Type Prefix/Suffix Length
1 Prefix my+ 2
2 Suffix +online 6
3 Prefix the+ 3
4 Suffix +web 3
5 Suffix +media 5
6 Prefix web+ 3
7 Suffix +world 5
8 Suffix +net 3
9 Prefix go+ 2
@ProGM
ProGM / arel_cheatsheet_on_steroids.md
Last active May 15, 2024 20:55
Arel cheatsheet on Steroids

Arel Cheatsheet on Steroids

A (more) complete cheatsheet for Arel, including NamedFunction functions, raw SQL and window functions.

Tables

posts = Arel::Table.new(:posts)
posts = Post.arel_table # ActiveRecord

Table alias

@olivierlemoal
olivierlemoal / event_listener.py
Last active February 17, 2021 19:48
i3 script to toggle between last windows
Moved to https://github.com/olivierlemoal/i3-swap-focus
@DoomHammer
DoomHammer / .tmux.conf
Last active May 12, 2021 23:38
An example Tmux configuration with plugins
## Prefix like in screen
set -g prefix 'C-a'
## Use xterm keys (makes eg. Ctrl+Arrow navigate words)
set-window-option -g xterm-keys on
## List of plugins
# For this to work you need to install https://github.com/tmux-plugins/tpm
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
@Gorcenski
Gorcenski / fizzbuzz.py
Last active May 23, 2022 23:55
The most obnoxious solution to FizzBuzz I can imagine.
import numpy as np
from functools import reduce
class Buzzer:
def __init__(self, **kwargs):
values = [v for k, v in kwargs.items()]
self.kwargs = kwargs
self.lcm = np.lcm.reduce(values)
self.eps = 1e-7
@superjose
superjose / .gitlab-ci.yml
Last active February 19, 2024 10:22
This is an example of a .gitlab-ci.yml that is required for Continuous Integration on GitLab projects.
# Reference: https://www.exclamationlabs.com/blog/continuous-deployment-to-npm-using-gitlab-ci/
# GitLab uses docker in the background, so we need to specify the
# image versions. This is useful because we're freely to use
# multiple node versions to work with it. They come from the docker
# repo.
# Uses NodeJS V 9.4.0
image: node:9.4.0
# And to cache them as well.
@eltonvs
eltonvs / arch_installation.md
Last active March 13, 2024 17:51
Arch Linux step to step installation guide

Arch Linux Installation Guide

This guide will show step-by-step how to Install Arch Linux on UEFI mode.

Table of Contents

  • Bootable Flash Drive
  • BIOS
  • Pre installation
    • Set Keyboard Layout
    • Check boot mode
  • Update System Clock
@zargony
zargony / config.yml
Last active December 16, 2020 16:47
CircleCI 2.0 configuration for Rust library crate project
version: 2
jobs:
test:
docker:
- image: rust:1
steps:
- checkout
- run:
name: Version information