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 | |
# Script to install PostgreSQL and PostGIS on a fresh Amazon Linux instance | |
# Installing from source: | |
# - GEOS | |
# GEOS 3.10+ requires CMake 3+, not readily available on Amazon Linux 2. | |
GEOSVER=3.9.2 | |
GEOSURL=http://download.osgeo.org/geos/geos-${GEOSVER}.tar.bz2 | |
# - PROJ (GDAL requires 6+; 6.2.1 is the last to use SQLite 3.7; 6.2 had build issues, so 6.1.1) |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
-- show running queries (9.2) | |
SELECT pid, age(query_start, clock_timestamp()), usename, query | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' | |
ORDER BY query_start desc; | |
-- kill running query | |
SELECT pg_cancel_backend(procpid); | |
-- kill idle query |
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 | |
MAX=10 | |
if [[ ! -z "$1" ]]; then | |
MAX=$1 | |
fi | |
for i in $( seq $MAX ); do | |
FILE=image${i}.jpg | |
curl 'https://thispersondoesnotexist.com/image' -H 'authority: thispersondoesnotexist.com' -H 'pragma: no-cache' -H 'cache-control: no-cache' -H 'upgrade-insecure-requests: 1' -H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.80 Safari/537.36' -H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3' -H 'referer: https://thispersondoesnotexist.com/' -H 'accept-encoding: gzip, deflate, br' -H 'accept-language: en-US,en;q=0.9' --compressed -o $FILE |
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
import urllib, os, sys, zipfile | |
def download(url,name=""): | |
if(name == ""): | |
name = url.split('/')[-1] | |
webFile = urllib.urlopen(url) | |
localFile = open(name, 'w') | |
fname = localFile.name | |
localFile.write(webFile.read()) | |
webFile.close() |
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
export CONTAINER_START=$( stat /proc/1/cmdline | grep Modify | awk '{print $2 " " $3}' ) | |
# run in shell through entrypoint or other cmd |
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 | |
TXT="text/plain; charset=us-ascii" | |
PNG="image/png; charset=binary" | |
JPEG="image/jpeg; charset=binary" | |
MOV="video/quicktime; charset=binary" | |
MP4="video/mp4; charset=binary" | |
GPP="video/3gpp; charset=binary" | |
for file in *; do | |
currfile=`file -b -i $file` |
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 | |
for file in `ls -1 | grep -e "[0-9]\{2\}-[0-9]\{2\}-[0-9]\{4\}" ` ; do | |
if [[ $file =~ ([0-9]{2})-([0-9]{2})-([0-9]{4})(.*)$ ]] ; then | |
newname=${BASH_REMATCH[3]}-${BASH_REMATCH[1]}-${BASH_REMATCH[2]}${BASH_REMATCH[4]} | |
echo "$file -> $newname " | |
mv -i $file $newname | |
else | |
echo Skipping $file... | |
fi |
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
colorscheme solarized | |
syntax on | |
filetype indent plugin on | |
set tabstop=4 | |
set expandtab | |
set shiftwidth=4 | |
set softtabstop=4 |
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
def buildPAMS(mun, blk, lot, qua=None): | |
"""Returns a PAMS Pin from three or four cadastre fields.""" | |
if (qua == None) or (qua == ''): | |
return "%s_%s_%s" % (mun, blk, lot) | |
else: | |
return "%s_%s_%s_%s" % (mun, blk, lot, qua) |
NewerOlder