Skip to content

Instantly share code, notes, and snippets.

Sebastian Webber sebastianwebber

Block or report user

Report or block sebastianwebber

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@sebastianwebber
sebastianwebber / crontab_contents.sh
Created Jul 15, 2019
list crontabs from all gcp servers
View crontab_contents.sh
#!/bin/bash
server_list=$(gcloud compute instances list --format='get(networkInterfaces[0].networkIP)' --filter="status=running")
for server in ${server_list[@]}; do
echo "server: $server"
ssh $server 'sudo cat /var/spool/cron/* /etc/crontab'
echo "-----------"
done
@sebastianwebber
sebastianwebber / find-history.sh
Created Feb 28, 2019
find YOUR git history amoung lots of git repositories
View find-history.sh
## include on your .zshrc (or similar)
#### tested on OSX
function findGitHistory() {
targetDir="${1}"
targetMonth="${2}"
targetYear="${3}"
targetUser=$(git config --get user.name)
View README.md

Race

small experiment on our go meetup.

tty-min

@sebastianwebber
sebastianwebber / pg-notify-parallel.go
Last active Jan 21, 2019
postgres listen/notifiy with golang and `go-pg`
View pg-notify-parallel.go
package main
import (
"log"
"time"
"github.com/go-pg/pg"
)
const maxWorkers = 5
@sebastianwebber
sebastianwebber / ftpd.mtail
Last active Jan 4, 2019
mtail prog to parse vsftpd logs in xferlog format
View ftpd.mtail
hidden text FILENAME
counter log_ftp_files_processed_count by username, remote_host, transfer_type, direction
counter log_ftp_files_deleted_count by username, remote_host, transfer_type
counter log_ftp_files_incomplete_transfers_count by username, remote_host, transfer_type
FILENAME = getfilename()
## example file
### Fri Jan 4 12:55:27 2019 1 1.2.3.4 224 /path/to/file.CSV b _ o r user_name ftp 0 * c
@sebastianwebber
sebastianwebber / main.go
Created Nov 7, 2018
exemplo interface e testes #golang
View main.go
package main
import (
"fmt"
)
type contrato interface {
Insert() string
}
@sebastianwebber
sebastianwebber / docker-compose.yml
Last active Oct 31, 2018
basic docker-compose for grafana and prometheus
View docker-compose.yml
version: '3.1'
volumes:
prometheus_data: {}
grafana_data: {}
services:
prometheus:
image: prom/prometheus
volumes:
@sebastianwebber
sebastianwebber / 0-update-test.sql
Last active May 9, 2018
update tests - to validate a pRest implementation
View 0-update-test.sql
-- tuning used: https://www.pgconfig.org/#/tuning?total_ram=10&max_connections=100&environment_name=WEB&pg_version=10&os_type=Unix&arch=x86-64&drive_type=SSD&share_link=true
-- mbp pro 15", 500gb ssd, 16gb ram, i7 2,9ghz processor
\timing on
\pset null ~
\set max_rows 1000
DROP TABLE IF EXISTS load_test;
create table load_test (id serial primary key, name text, birth_date date, age int);
@sebastianwebber
sebastianwebber / compare-pg-lsn.rb
Last active Mar 20, 2018
Compare PostgreSQL LSN in ruby
View compare-pg-lsn.rb
# select pg_xlog_location_diff('951A/EA0F8000', '9518/1ECB6000');
# super_db=# select pg_xlog_location_diff('951A/EA0F8000', '9518/1ECB6000');
# pg_xlog_location_diff
# -----------------------
# 12000174080
# (1 row)
# super_db=# select pg_xlogfile_name('951A/EA0F8000'), pg_xlogfile_name('9518/1ECB6000');
# -[ RECORD 1 ]----+-------------------------
# pg_xlogfile_name | 000000030000951A000000EA
@sebastianwebber
sebastianwebber / create-ec2-instance-playbook.yml
Last active May 26, 2017
Create a EC2 instance with ansible-playbook
View create-ec2-instance-playbook.yml
---
- hosts: localhost
connection: local
vars:
gather_facts: False
vars:
keypair: "my-keypair-name"
instance_type: m4.large
security_group:
- "vpc-group-1"
You can’t perform that action at this time.