This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE VIEW public.vw_random_string AS | |
SELECT substr(string_agg(substr('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'::text, ceil(random() * 62::double precision)::integer, 1), ''::text), 0, 10) AS rand_str | |
FROM generate_series(1, 45) generate_series(generate_series); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE FUNCTION _final_median(NUMERIC[]) | |
RETURNS NUMERIC AS | |
$$ | |
SELECT AVG(val) | |
FROM ( | |
SELECT val | |
FROM unnest($1) val | |
ORDER BY 1 | |
LIMIT 2 - MOD(array_upper($1, 1), 2) | |
OFFSET CEIL(array_upper($1, 1) / 2.0) - 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH indexes AS ( | |
SELECT | |
trel.relname AS table_name, | |
irel.relname AS index_name, | |
string_agg(a.attname, ', ' ORDER BY c.ordinality) AS columns | |
FROM pg_index AS i | |
JOIN pg_class AS trel ON trel.oid = i.indrelid | |
JOIN pg_class AS irel ON irel.oid = i.indexrelid | |
JOIN pg_attribute AS a ON trel.oid = a.attrelid | |
JOIN LATERAL unnest(i.indkey) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with ld as ( | |
select pid, array_agg(lock_detail) as lock_details | |
from ( | |
select l.pid, concat(l.mode, ' on ', l.locktype, ' (Table: ', t.relname,')') as lock_detail | |
from pg_catalog.pg_locks l | |
left outer join pg_stat_all_tables t on t.relid = l.relation | |
where t.relname not like 'pg_%' | |
) as details | |
group by pid | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Welches Spielzeug sollte es heute noch geben? | |
Was waren deine ersten 3 CDs/Platten? | |
Wenn du dich auf 3 Nahrungsmittel beschränken müsstest - welche? | |
Wenn du ein eigenes Flugzeug für einen Urlaub hättest - wohin würdest du fliegen? | |
An welchen historischen Moment erinnerst du dich am meisten? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -euo pipefail | |
PROCESS_NAME=$1 | |
PID_PRC=`ps aux | grep '${PROCESS_NAME}' | grep -v grep | awk '{print $2}'` | |
if [ -n "$PID_PRC" ] | |
then | |
echo "Found running process -> killing PID: '$PID_PRC'" | |
kill $PID_PRC | |
else | |
echo "Process not running" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo 'kern.maxfiles=20480' | sudo tee -a /etc/sysctl.conf | |
echo -e 'limit maxfiles 8192 20480\nlimit maxproc 1000 2000' | sudo tee -a /etc/launchd.conf | |
echo 'ulimit -n 4096' | sudo tee -a /etc/profile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Just copy and paste the lines below (all at once, it won't work line by line!) | |
# MAKE SURE YOU ARE HAPPY WITH WHAT IT DOES FIRST! THERE IS NO WARRANTY! | |
function abort { | |
echo "$1" | |
exit 1 | |
} | |
set -e |
NewerOlder