Skip to content

Instantly share code, notes, and snippets.

View pathcl's full-sized avatar

Luis San Martin pathcl

View GitHub Profile
@pathcl
pathcl / gitlab-reenable-signin.sh
Created January 3, 2024 18:37 — forked from 0xKayvan/gitlab-reenable-signin.sh
enable gitlab sign-in after accidentally disable it in admin
sudo gitlab-rails console
ApplicationSetting.last.update_attributes(signin_enabled: true)
exit
sudo gitlab-ctl restart
@pathcl
pathcl / docker-exec-ecs.sh
Created June 2, 2022 17:30 — forked from ipmb/docker-exec-ecs.sh
docker exec on AWS ECS with SSM
#!/bin/bash
# USAGE: CLUSTER=mycluster SERVICE=myservice ./docker-exec-ecs.sh
set -euf -o pipefail
TASK_ARN=$(aws ecs list-tasks --cluster=$CLUSTER --service=$SERVICE \
| jq -r .taskArns[0])
if [ "$TASK_ARN" = "null" ]; then
echo "Could not find any running tasks for $SERVICE on cluster:$CLUSTER."
exit 1
fi
@pathcl
pathcl / latency.txt
Created June 23, 2021 09:06 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@pathcl
pathcl / tail.py
Created January 6, 2021 12:45 — forked from amitsaha/tail.py
Simple implementation of the tail command in Python
'''
Basic tail command implementation
Usage:
tail.py filename numlines
'''
import sys
import linecache
@pathcl
pathcl / rabbitmq-cluster.md
Created December 20, 2020 20:34 — forked from pobsuwan/rabbitmq-cluster.md
How to config rabbitmq server cluster [3 nodes]

How to config rabbitmq server cluster [3 nodes]

Edit /etc/hosts

vi /etc/hosts
192.168.10.157  rabbitmq-1
192.168.10.159  rabbitmq-2
192.168.10.161  rabbitmq-3
@pathcl
pathcl / npm-using-https-for-git.sh
Created May 9, 2019 09:19 — forked from taoyuan/npm-using-https-for-git.sh
Force git to use https:// instead of git://
git config --global url."https://github.com/".insteadOf git@github.com:
git config --global url."https://".insteadOf git://
@pathcl
pathcl / tmux.md
Created May 8, 2019 13:15 — forked from andreyvit/tmux.md
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@pathcl
pathcl / git_rebase.md
Created October 21, 2018 11:25 — forked from ravibhure/git_rebase.md
Git rebase from remote fork repo

In your local clone of your forked repository, you can add the original GitHub repository as a "remote". ("Remotes" are like nicknames for the URLs of repositories - origin is one, for example.) Then you can fetch all the branches from that upstream repository, and rebase your work to continue working on the upstream version. In terms of commands that might look like:

Add the remote, call it "upstream":

git remote add upstream https://github.com/whoever/whatever.git

Fetch all the branches of that remote into remote-tracking branches, such as upstream/master:

git fetch upstream

@pathcl
pathcl / main.go
Created July 23, 2018 11:06 — forked from zupzup/main.go
ElasticSearch to Prometheus Exporter in Go
package main
import (
"context"
"github.com/go-chi/chi"
"github.com/go-chi/render"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
log "github.com/sirupsen/logrus"
"gopkg.in/olivere/elastic.v6"
@pathcl
pathcl / clusterrolebindings.yml
Created April 20, 2018 17:17 — forked from jimmycuadra/clusterrolebindings.yml
Default RBAC cluster roles and cluster role bindings built into Kubernetes
apiVersion: v1
items:
- apiVersion: rbac.authorization.k8s.io/v1alpha1
kind: ClusterRoleBinding
metadata:
creationTimestamp: 2017-02-23T00:03:51Z
name: cluster-admin
namespace: ""
resourceVersion: "35"
selfLink: /apis/rbac.authorization.k8s.io/v1alpha1/clusterrolebindingscluster-admin