Skip to content

Instantly share code, notes, and snippets.

@asanchez75
asanchez75 / vim-shortcuts.md
Created October 29, 2020 16:39 — forked from tuxfight3r/vim-shortcuts.md
VIM SHORTCUTS

VIM KEYBOARD SHORTCUTS

MOVEMENT

h        -   Move left
j        -   Move down
k        -   Move up
l        -   Move right
$        -   Move to end of line
0        -   Move to beginning of line (including whitespace)
SELECT * FROM sys_rdf_schema;
ld_dir('/data', '*.ttl', 'http://www.example.com/genealogy.owl#');
delete from DB.DBA.load_list where ll_file='/data//einstein.ttl';
SPARQL SELECT (COUNT(DISTINCT ?x) AS ?count) WHERE { ?x ?y ?z };
sparql clear graph <http://www.example.com/genealogy.owl#>;
sparql load <https://github.com/blokhin/genealogical-trees/raw/master/data/header.ttl> into <http://www.example.com/genealogy.owl#>;
rdfs_rule_set('fhkb', 'http://www.example.com/genealogy.owl#');
SPARQL SELECT ?g count(*) as ?count WHERE { GRAPH ?g {?s ?p ?o } } GROUP BY ?g ORDER BY DESC 2;

Lsyncd Technical Session

So what is lsyncd?

Lsyncd is a tool used to keep a source directory in sync with other local or remote directories. It is a solution suited keeping directories in sync by batch processing changes over to the synced directories.

When would we use lsyncd?

So the generic use case is to keep a source directory in sync with one or more local and remote directories.

@asanchez75
asanchez75 / trim.awk
Created March 21, 2020 07:01 — forked from andrewrcollins/trim.awk
ltrim(), rtrim(), and trim() in awk
function ltrim(s) { sub(/^[ \t\r\n]+/, "", s); return s }
function rtrim(s) { sub(/[ \t\r\n]+$/, "", s); return s }
function trim(s) { return rtrim(ltrim(s)); }
BEGIN {
# whatever
}
{
# whatever
}
END {
@asanchez75
asanchez75 / tmux.md
Created February 26, 2020 12:40 — forked from Bekbolatov/tmux.md
Clean tmux cheat-sheet

Clean tmux cheat-sheet

By resources

sessions

list-sessions        ls         -- List sessions managed by server
new-session          new        -- Create a new session
@asanchez75
asanchez75 / nginx_reverse_for_notebook
Created February 10, 2020 12:30 — forked from kent119/nginx_reverse_for_notebook
Config Nginx as a reverse proxy for Jupyter notebook on VPS
# /etc/nginx/sites-enabled/some.domain
# Change the server name {some.domain}
# Change the {host.of.notebook} and {port} in the following locations
server {
listen 80;
# Change the server name {some.domain}
server_name some.domain;
location / {
# Change the {host.of.notebook} and {port}
proxy_pass http://host.of.notebook:port;
@asanchez75
asanchez75 / Vagrantfile
Created February 7, 2020 13:21 — forked from z3cka/Vagrantfile
Sample base Vagrantfile with 2GB of ram and 2 cpus :-) Initialize with: vagrant init precise32 http://files.vagrantup.com/precise32.box
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "precise32"
@asanchez75
asanchez75 / vagrant-kvm.md
Created February 2, 2020 18:14 — forked from yuanying/vagrant-kvm.md
How to use vagrant-kvm

Install Vagrant

sudo su
apt-get update && apt-get install -y libvirt-dev ruby-all-dev apparmor-utils
curl -O -L https://dl.bintray.com/mitchellh/vagrant/vagrant_1.6.5_x86_64.deb
dpkg -i vagrant_1.6.5_x86_64.deb 
aa-complain /usr/lib/libvirt/virt-aa-helper # workaround
exit

Install vagrant-kvm as user

@asanchez75
asanchez75 / docker-ps-vertical.md
Created January 28, 2020 16:06 — forked from ergoz/docker-ps-vertical.md
vertical format for docker ps
export FORMAT="ID\t{{.ID}}\nNAME\t{{.Names}}\nIMAGE\t{{.Image}}\nPORTS\t{{.Ports}}\nCOMMAND\t{{.Command}}\nCREATED\t{{.CreatedAt}}\nSTATUS\t{{.Status}}\n"

usage:

docker ps --format="$FORMAT"

https://cloud.githubusercontent.com/assets/7823011/19899780/41ff0db4-a09c-11e6-95f2-e275fb80bd2b.gif

@asanchez75
asanchez75 / haproxy.cfg
Created December 15, 2019 11:37 — forked from arkady-emelyanov/haproxy.cfg
haproxy check: postgresql is master
# Sample haproxy postgresql master check
#
# haproxy listen: 5431
# pg, instance #1 listen: 5432 (master node)
# pg, instance #2 listen: 5433 (replica node)
# external failover, promoting replica to master in case of failure
# passwordless auth for user web
# template1 database is accessible by user web
#
# haproxy will pass connection to postgresql master node: