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 / README.md
Last active Sep 17, 2019
Compilation of the Uber Facts on PostgreSQL to MySQL Migration
View README.md

Uber facts

Original posts/information

Migrating Uber from MySQL to PostgreSQL

Key points

  • ~50GB MySQL Application
  • Main motivation: PostGis
  • Migration made with a custom tool(xml2pgcopy) and mysqldump on 45min
@sebastianwebber
sebastianwebber / generate_series.sql
Last active Jul 28, 2019
SQL Server generate_series
View generate_series.sql
-- http://blog.jooq.org/2013/11/19/how-to-create-a-range-from-1-to-10-in-sql/
IF EXISTS (SELECT *
FROM dbo.sysobjects
WHERE id = object_id (N'[dbo].[generate_series]')
AND OBJECTPROPERTY(id, N'IsTableFunction') = 1)
DROP FUNCTION [dbo].[generate_series]
GO
CREATE FUNCTION [dbo].[generate_series] ( @p_start INT, @p_end INT)
@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 / README.md
Last active Apr 6, 2019
Zabbix 3 Install on CEntOS 7 with PostgreSQL 9.5
View README.md

Zabbix 3 Install on CEntOS 7 with PostgreSQL 9.5

Repo installation

Zabbix repo

yum install http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm
@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
View pg_cleanup_oldmorethan_30days.sh
#!/bin/bash
ARCHIVEDIR='/var/lib/pgsql/wal_archive'
LAST_BACKUP=$(ls -lto ${ARCHIVEDIR})
FILE_LIST=$(pg_archivecleanup -n "${ARCHIVEDIR}" "${LAST_BACKUP}")
## TEST FIRST
pg_archivecleanup -n "${ARCHIVEDIR}" "${LAST_BACKUP}" | find -type f -mmin +30 | xargs ls -lh
@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
}
You can’t perform that action at this time.