Skip to content

Instantly share code, notes, and snippets.

View sebastianwebber's full-sized avatar
🏠
Working from home

Sebastian Webber sebastianwebber

🏠
Working from home
View GitHub Profile
@matheusoliveira
matheusoliveira / json_manipulator.sql
Last active February 17, 2024 15:14
Simple PostgreSQL functions to manipulate json objects. (Note: performance is not a concern for those functions)
CREATE OR REPLACE FUNCTION public.json_append(data json, insert_data json)
RETURNS json
IMMUTABLE
LANGUAGE sql
AS $$
SELECT ('{'||string_agg(to_json(key)||':'||value, ',')||'}')::json
FROM (
SELECT * FROM json_each(data)
UNION ALL
SELECT * FROM json_each(insert_data)
@ivan-pinatti
ivan-pinatti / jenkins-set-url-and-email.groovy
Last active September 22, 2023 20:20
Jenkins - Set URL and email via groovy script - #jenkins #groovy
#!groovy
// imports
import jenkins.model.Jenkins
import jenkins.model.JenkinsLocationConfiguration
// parameters
def jenkinsParameters = [
email: 'Jenkins Admin <admin@jenkins.com>',
url: 'https://ci.jenkins.com:8083/'
@afair
afair / gist:3803895
Last active August 7, 2023 07:43
PostgreSQL and Pgpool Architecture

Hey! I saw this has been indexed by the search engines. It is a first draft of a post I ended up publishing on my blog at: Scaling PostgreSQL With Pgpool and PgBouncer

Thanks for stopping by!

PostgreSQL and Pgpool Architecture

@Eugeny
Eugeny / memuse.md
Last active February 1, 2023 01:57
memuse - measure a total unique RAM taken by process tree
@rafaeltuelho
rafaeltuelho / install-gosu-centos.md
Last active February 23, 2022 04:56
installing gosu on a centos docker box
# Install gosu.  https://github.com/tianon/gosu
ENV GOSU_VERSION=1.11
RUN gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \
    && curl -o /usr/local/bin/gosu -SL "https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-amd64" \
    && curl -o /usr/local/bin/gosu.asc -SL "https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-amd64.asc" \
    && gpg --verify /usr/local/bin/gosu.asc \
    && rm /usr/local/bin/gosu.asc \
    && rm -r /root/.gnupg/ \
 &amp;&amp; chmod +x /usr/local/bin/gosu \
ssl = off
maintenance_work_mem = 2GB
work_mem = 2GB
fsync = off
synchronous_commit = off
wal_level = minimal
max_wal_senders = 0
archive_mode = off
wal_buffers = -1
wal_writer_delay = 20ms
@swdunlop
swdunlop / identifypanic.go
Created March 18, 2014 20:45
Identify a GOLANG Panic Function and Line in Recovery
// You can edit this code!
// Click here and start typing.
package main
import "fmt"
import "runtime"
import "strings"
func identifyPanic() string {
var name, file string
@lfryc
lfryc / gist:aae879ceb5534292e150
Last active May 11, 2020 18:51
Switch WildFly to debug mode in Runtime using jboss-cli
# switch the log level to DEBUG on console
{wildfly}/bin/jboss-cli.sh --connect
[standalone@localhost:9990 /] /subsystem=logging/console-handler=CONSOLE:write-attribute(name=level,value=DEBUG)
[standalone@localhost:9990 /] /subsystem=logging/root-logger=ROOT:write-attribute(name=level,value=DEBUG)
# switch it back to whatever it was initial configuration (here it is INFO)
[standalone@localhost:9990 /] /subsystem=logging/console-handler=CONSOLE:write-attribute(name=level,value=INFO)
[standalone@localhost:9990 /] /subsystem=logging/root-logger=ROOT:write-attribute(name=level,value=INFO)
WITH btree_index_atts AS (
SELECT nspname, relname, reltuples, relpages, indrelid, relam,
regexp_split_to_table(indkey::text, ' ')::smallint AS attnum,
indexrelid as index_oid
FROM pg_index
JOIN pg_class ON pg_class.oid=pg_index.indexrelid
JOIN pg_namespace ON pg_namespace.oid = pg_class.relnamespace
JOIN pg_am ON pg_class.relam = pg_am.oid
WHERE pg_am.amname = 'btree'
),