Skip to content

Instantly share code, notes, and snippets.

View 3manuek's full-sized avatar
🤖
tr3s.ma

Emanuel Calvo 3manuek

🤖
tr3s.ma
View GitHub Profile
@3manuek
3manuek / gist:63a3d46b384bad2fde6907a4503131b1
Created November 24, 2017 20:51
Visual Code Key Bindings for Integrated Terminal keybindings.json
[
{
"key": "ctrl+shift+u",
"command": "editor.action.transformToUppercase",
"when": "editorTextFocus"
},{
"key": "ctrl+shift+l",
"command": "editor.action.transformToLowercase",
"when": "editorTextFocus"
},
@3manuek
3manuek / gist:58602503df729980a276804fa5e23e07
Last active October 15, 2017 04:13
The estimating project time game
## Mechanics of the estimation
- Divide the project in phases, each within its deliverable.
- Ask the people in the meeting what is the estimation of hours per each phase.
- Get the average of the _n_ hours on each vote
n
mu = 1/n (∑ x_i)
i=1
@3manuek
3manuek / gist:e7e728e0635bb797ca909b8d45deb5d5
Created February 26, 2017 21:30
Random words on Postgres with coherence, no trash characters (FTS tests)
# In bash, copy the file into the datadir:
cp /usr/share/dict/words data/pg95/words.list
CREATE TABLE randomTable(id serial PRIMARY KEY, description text);
CREATE INDEX ON randomTable USING GIN(to_tsvector('english',description));
CREATE OR REPLACE FUNCTION getNArrayS(el text[], count int) RETURNS text AS $$
# Escaped with $ as this runs from bash!
bin/psql -p7777 -Upostgres <<EOF
\c postgres
DROP DATABASE IF EXISTS shard0;
CREATE DATABASE shard0;
\c shard0
CREATE EXTENSION postgres_fdw;
CREATE SERVER shard0 FOREIGN DATA WRAPPER postgres_fdw
@3manuek
3manuek / gist:0d411c6b8e3999bf6b0add3b5e73c3b6
Last active February 11, 2017 06:55
pglogical dependencies not mentioned on doc
apt-get install libedit-dev libpam0g-dev libselinux1-dev
wal_level = 'logical'
max_worker_processes = 10 # one per database needed on provider node
# one per node needed on subscriber node
max_replication_slots = 10 # one per node needed on provider node
max_wal_senders = 10 # one per node needed on provider node
shared_preload_libraries = 'pglogical'
track_commit_timestamp = on
@3manuek
3manuek / gist:0a6dec10cd796ec2e13f3f92eacf3642
Last active December 29, 2018 16:21
Postgres sharding using FOREIGN DATA WRAPPERS and inheritance. [WIP]
# Sharding within Foreign Data Wrappers and Inheritance [WIP]
Previous sources:
https://www.depesz.com/2015/04/02/waiting-for-9-5-allow-foreign-tables-to-participate-in-inheritance/
http://snowman.net/slides/pgfdw_sharding.pdf
Postgres 10 next things:
https://wiki.postgresql.org/wiki/Built-in_Sharding
<logical replication>
Also https://github.com/guriandoro/docker , same but dockerized.
alias ll='ls -lha'
alias ls='ls --color=auto'
alias lxc-attach='lxc-attach -P $PWD'
alias lxc-create='lxc-create -P $PWD'
alias lxc-destroy='lxc-destroy -P $PWD'
alias lxc-info='lxc-info -P $PWD'
alias lxc-ls='lxc-ls --fancy -P $PWD'
@3manuek
3manuek / gist:d6228123323e03cfdaca52df2aa78634
Last active November 8, 2016 21:36
myrocks being hit by linkbench
linkbench log:
```
INFO 2016-11-08 16:27:41,756 [Thread-7]: 667264/10000000 id1s loaded (6.7% complete) at 467.66 id1s/sec avg. 2650991 links loaded at 1857.97 links/sec avg.
INFO 2016-11-08 16:27:48,497 [Thread-1]: 675456/10000000 id1s loaded (6.8% complete) at 471.17 id1s/sec avg. 2707233 links loaded at 1888.47 links/sec avg.
INFO 2016-11-08 16:28:15,157 [Thread-6]: 687744/10000000 id1s loaded (6.9% complete) at 470.99 id1s/sec avg. 2759075 links loaded at 1889.49 links/sec avg.
INFO 2016-11-08 16:29:09,943 [Thread-8]: 700032/10000000 id1s loaded (7.0% complete) at 462.06 id1s/sec avg. 2822366 links loaded at 1862.94 links/sec avg.
INFO 2016-11-08 16:29:35,518 [Thread-4]: 710272/10000000 id1s loaded (7.1% complete) at 461.04 id1s/sec avg. 2855556 links loaded at 1853.55 links/sec avg.
INFO 2016-11-08 16:30:45,513 [Thread-5]: 722560/10000000 id1s loaded (7.2% complete) at 448.63 id1s/sec avg. 2953569 links loaded at 1833.86 links/sec avg.
@3manuek
3manuek / gist:af1d2bc9a24e3c166ecac45c307d24a3
Last active September 21, 2016 15:06
get files for ksar
DT=$(ls /var/log/sa/sa[0-9][0-9] | tr '\n' ' ' | sed 's/\/var\/log\/sa\/sa/ /g')
rm /tmp/sar-$(hostname)*-multiple.txt
for i in $DT; do
LC_ALL=C sar -A -f /var/log/sa/sa$i >> /tmp/sar-$(hostname)-{$i}-multiple.txt
done
tar cf allsars.tar /tmp/sar-$(hostname)*multiple.txt
--
@3manuek
3manuek / fts_doc_id.sql
Created April 27, 2016 20:43
Create a table with FTS_DOC_ID
CREATE TABLE test ( FTS_DOC_ID bigint unsigned AUTO_INCREMENT,
mainPk bigint, other text,
PRIMARY KEY(mainPk),
UNIQUE(FTS_DOC_ID)
);