Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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 the table | |
CREATE TABLE IF NOT EXISTS `StateBoundaries` ( | |
`State` varchar(10) DEFAULT NULL, | |
`Name` varchar(255) DEFAULT NULL, | |
`MinLat` varchar(50) DEFAULT NULL, | |
`MaxLat` varchar(50) DEFAULT NULL, | |
`MinLon` varchar(50) DEFAULT NULL, | |
`MaxLon` varchar(50) DEFAULT NULL | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
This file contains hidden or 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
library(slippymath) | |
library(sf) | |
library(purrr) | |
library(curl) | |
library(glue) | |
library(raster) | |
library(rgdal) | |
# pass map.bounds() & zoom from leaflet | |
# xmin <- map.getBounds()["_southWest"]['lat'] |
This file contains hidden or 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 TEMPORARY FUNCTION capitalize(str STRING) | |
RETURNS STRING | |
LANGUAGE js AS """ | |
return str.replace( | |
/\\w\\S*/g, | |
function(txt) { | |
return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase(); | |
} | |
); | |
"""; |
This file contains hidden or 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 jsonb_array_to_text_array( | |
p_input jsonb | |
) RETURNS TEXT[] AS $BODY$ | |
DECLARE v_output text[]; | |
BEGIN | |
SELECT array_agg(ary)::text[] | |
INTO v_output |
This file contains hidden or 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
BEGIN transaction; | |
DO $$DECLARE r record; | |
BEGIN | |
FOR r IN SELECT table_name,constraint_name | |
FROM information_schema.constraint_table_usage | |
WHERE table_name IN ('table_1', 'table_2', 'table_3') /* here be the tables to select. refactor if you want to select all */ | |
AND constraint_name ~'\d$' /* pattern matcher */ | |
LOOP | |
EXECUTE 'ALTER TABLE ' || quote_ident(r.table_name)|| ' DROP CONSTRAINT '|| quote_ident(r.constraint_name) || ';'; |
This file contains hidden or 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
class CredFinder | |
attr_accessor :cred_hsh | |
def initialize(urn) | |
puts "***** \nSapSucking Creds For -- \n#{urn} \n*****" | |
@cms_urn = urn | |
@cred_hsh = {'dbname'=>'','host'=>'','port'=>'','user'=>'', 'password'=>''} | |
build_creds | |
end | |
def build_creds |
This file contains hidden or 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
do | |
$$ | |
declare | |
l_rec record; | |
begin | |
for l_rec in (select foreign_table_schema, foreign_table_name | |
from information_schema.foreign_tables) loop | |
execute format('drop foreign table %I.%I cascade', l_rec.foreign_table_schema, l_rec.foreign_table_name); | |
end loop; | |
end; |
NewerOlder