Skip to content

Instantly share code, notes, and snippets.

View WeslyG's full-sized avatar
🎯
Focusing

Vladimir Lila WeslyG

🎯
Focusing
  • Yandex.Cloud
  • Yekaterinburg
View GitHub Profile

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@pascaldevink
pascaldevink / scrollspy.js
Created April 13, 2012 20:53
ScrollSpy in pure javascript
/*
Copyright (C) 2021 Pascal de Vink (Tweakers.net)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@jacobian
jacobian / gridfs-vs-lobjects.py
Last active December 29, 2021 11:21
Benchmarking MongoDB's GridFS vs PostgreSQL's LargeObjects.
import io
import pymongo
import psycopg2
import gridfs
import timeit
# For fairness use the same chunk size - 512k.
CHUNK_SIZE = 1024 * 512
def bench_mongo(fs, size):
@staltz
staltz / introrx.md
Last active May 20, 2024 14:59
The introduction to Reactive Programming you've been missing
@ngauthier
ngauthier / timeout_and_tick.go
Created February 10, 2015 18:14
Golang timeout and tick loop
// keepDoingSomething will keep trying to doSomething() until either
// we get a result from doSomething() or the timeout expires
func keepDoingSomething() (bool, error) {
timeout := time.After(5 * time.Second)
tick := time.Tick(500 * time.Millisecond)
// Keep trying until we're timed out or got a result or got an error
for {
select {
// Got a timeout! fail with a timeout error
case <-timeout:
@leucos
leucos / .git_hooks_pre-commit
Last active March 12, 2024 22:49
ansible-vault pre-commit hook
#!/bin/sh
#
# Pre-commit hook that verifies if all files containing 'vault' in the name
# are encrypted.
# If not, commit will fail with an error message
#
# Original author: @ralovely
# https://www.reinteractive.net/posts/167-ansible-real-life-good-practices
#
# File should be .git/hooks/pre-commit and executable
@kizbitz
kizbitz / dockerhub-v2-api-organization.sh
Last active April 3, 2024 08:47
Get the list of images and tags for a Docker Hub organization account
#!/bin/bash
# Example for the Docker Hub V2 API
# Returns all images and tags associated with a Docker Hub organization account.
# Requires 'jq': https://stedolan.github.io/jq/
# set username, password, and organization
UNAME=""
UPASS=""
ORG=""
@igorcosta
igorcosta / elastic_cheat_sheet.md
Created January 6, 2017 00:42 — forked from quantizor/elastic_cheat_sheet.md
Elastic Cheat Sheet
@cecilemuller
cecilemuller / launch.json
Last active May 16, 2024 16:38
Run ts-node in VSCode Debugger
{
"version": "0.2.0",
"configurations": [
{
"name": "Example",
"type": "node",
"request": "launch",
"runtimeExecutable": "node",
"runtimeArgs": ["--nolazy", "-r", "ts-node/register/transpile-only"],
@aaronk6
aaronk6 / check-vault-encryption
Created October 19, 2018 14:39
Git pre-receive hook to ensure Ansible Vault encryption
#!/usr/bin/env bash
set -o errexit
set -o nounset
TEMPDIR=$(mktemp -d)
prefix="[vault-check]"
zero_commit="0000000000000000000000000000000000000000"
bad_file=0