View time_histogram.sql
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 time_histogram( | |
start_time timestamp, | |
end_time timestamp | |
) | |
RETURNS TABLE(bucket timestamp) AS $$ | |
DECLARE diff_hours int; | |
BEGIN | |
diff_hours = abs(extract(epoch from end_time - start_time) / 3600) | |
raise notice 'diff hours: ', diff_hours; |
View posgres_size.sql
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 RECURSIVE pg_inherit(inhrelid, inhparent) AS | |
(select inhrelid, inhparent | |
FROM pg_inherits | |
UNION | |
SELECT child.inhrelid, parent.inhparent | |
FROM pg_inherit child, pg_inherits parent | |
WHERE child.inhparent = parent.inhrelid), | |
pg_inherit_short AS (SELECT * FROM pg_inherit WHERE inhparent NOT IN (SELECT inhrelid FROM pg_inherit)) | |
SELECT table_schema | |
, TABLE_NAME |
View IsLoopbackOrPrivate.cs
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
static bool IsLoopbackOrPrivate([NotNull] IPAddress clientIp) | |
{ | |
// RFC for private networks: | |
// http://www.faqs.org/rfcs/rfc1918.html | |
byte[] bytes = clientIp.GetAddressBytes(); | |
switch(bytes[0]) | |
{ | |
case 10: | |
return true; |
View animals.txt
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
Alligator | |
Anteater | |
Armadillo | |
Axolotl | |
Badger | |
Bat | |
Beaver | |
Buffalo | |
Camel | |
Capybara |
View name_blacklist.txt
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
airhead | |
allah | |
altar | |
anal | |
anus | |
aryan | |
ass | |
ass lick | |
asshole | |
asshole cleaner |
View pi-mount.sh
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
sudo apt-get update | |
sudo apt-get upgrade -y | |
# install hfs tools (for macos extended journaled) | |
sudo apt-get install hfsplus hfsutils hfsprogs | |
sudo reboot | |
# get device id | |
df -h | |
# example: |
View Dockerfile
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
# https://github.com/dotnet/diagnostics/issues/573#issuecomment-543886037 | |
# dotnet tools are currently available as part of SDK so we need to create them in an sdk image | |
# and copy them to our final runtime image | |
FROM mcr.microsoft.com/dotnet/core/sdk:3.0 AS tools-install | |
RUN dotnet tool install --tool-path /dotnetcore-tools dotnet-sos | |
RUN dotnet tool install --tool-path /dotnetcore-tools dotnet-trace | |
RUN dotnet tool install --tool-path /dotnetcore-tools dotnet-dump | |
RUN dotnet tool install --tool-path /dotnetcore-tools dotnet-counters |
View postgres_version.sql
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
select version(); | |
-- PostgreSQL 9.6.12 on x86_64-pc-linux-musl, compiled by gcc (Alpine 8.2.0) 8.2.0, 64-bit | |
SHOW server_version; | |
-- 9.6.12 | |
SELECT current_setting('server_version_num'); | |
-- 90612 | |
select current_setting('server_version'); |
View text_replace.sh
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
function text_replace() { | |
case "${OSTYPE}" in | |
darwin*) PLATFORM="OSX" ;; | |
linux*) PLATFORM="LINUX" ;; | |
bsd*) PLATFORM="BSD" ;; | |
*) PLATFORM="UNKNOWN" ;; | |
esac | |
if [[ "${PLATFORM}" == "OSX" || "${PLATFORM}" == "BSD" ]]; then | |
find $1 -type f -name $2 -exec sed -i "" "s/$3/$4/g" {} + |
View kubetool.sh
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 | |
[[ -n $DEBUG ]] && set -x | |
set -eou pipefail | |
usage() { | |
cat <<"EOF" | |
USAGE: | |
kubetool : show this message | |
kubetool ctx get : gets the current context |
NewerOlder