Skip to content

Instantly share code, notes, and snippets.

@kdclaw3
kdclaw3 / mapLayers.sql
Created September 10, 2024 14:41
Adam
-- add work layer group if not exists
INSERT INTO systemlookup
(id, org, [type], [name])
SELECT
id + 'work_layer_group' id,
id as org,
'MAP_LAYER_GROUP' [type],
'Work' [name]
FROM org o
where id = '${orgId}'
@kdclaw3
kdclaw3 / cheatsheet.txt
Created October 25, 2023 18:00
Mapbox Stylesheet Cheatsheet
// icon
{
"type": "symbol",
"layout": {
"icon-size": 0.5
},
"paint": {}
}
// point
@kdclaw3
kdclaw3 / loop.js
Created August 3, 2023 14:01
MentorAPM Jr. Dev Interview Cheat Sheet
(async function () {
const { layers } = await (await fetch('https://.../arcgis/rest/services/.../MapServer?f=pjson')).json();
const layersById = layers.reduce((acc, item) => {
acc[item.id] = item;
return acc;
}, {});
let usedIcons = [];
@kdclaw3
kdclaw3 / activity_document.sql
Last active August 3, 2023 14:03
Activity Document Example SQL
/*
----------------------------------------------------------------------------------------------------
Table: W1_DOCUMENT - Document
----------------------------------------------------------------------------------------------------
The data for CLOB/XML field BO_DATA_AREA should be enclosed by <endclob>.
Delimiter: ,
Enclosing Character: "
For not-nullable fields with no value, provide a single space enclosed in enclosing character
Fields:
The first 30 characters contain target table name W1_DOCUMENT padded with spaces
@kdclaw3
kdclaw3 / backup.sql
Created April 2, 2023 11:56
Backup MSSQL Server to S3
declare @v_db nvarchar(255) = 'sample';
declare @v_bkup_name nvarchar(255) = (select @v_db + format(sysdatetime(),'_yyyyMMdd_HHmm') + '.bak');
declare @v_arn nvarchar(510) = 'arn:aws:s3:::sample-databasebackups/' + @v_bkup_name;
print '=====backing up database====='
print 'database: ' + @v_db;
print 'filename: ' + @v_bkup_name;
print 'arn: ' + @v_arn;
exec msdb.dbo.rds_backup_database
@source_db_name= @v_db, --database name
@kdclaw3
kdclaw3 / refresh.sql
Last active January 20, 2023 12:30
Sql Server View Refresh
/*
refresh sql server database views
*/
declare @name varchar(max) = ''
declare viewCursor cursor
for
select distinct [name]
from [sysobjects]
where [type] = 'V';
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kdclaw3
kdclaw3 / aws_monitron.js
Last active September 21, 2021 17:57
Amazon Monitron Lamda Function
// Amazon Monitron Lamda Function
// Basic Example grabbing info from S3 Bicket
const aws = require('aws-sdk');
const s3 = new aws.S3({ apiVersion: '2006-03-01' });
var ses = new aws.SES({ region: "us-east-1" });
const prefix = '[LOGPREFIX] '
exports.handler = async (event, context) => {
@kdclaw3
kdclaw3 / upload.js
Last active September 21, 2021 17:47
Oracle OCI Object Storage Upload Example
// Oracle OCI Object Storage Upload Example
// Using Upload Manager with Progress Bar Tracking
// imports
const fs = require('fs');
const { basename, join } = require('path');
const cliProgress = require('cli-progress');
const os = require('oci-objectstorage');
const common = require('oci-common');
@kdclaw3
kdclaw3 / load_file.sql
Last active August 14, 2021 15:34
load_file.sql
/*
Load Files into Clob from Filesystem Using PL/SQL
Dee Clawson
20210814
MIT License
*/
res CLOB;
v_bfile BFILE;
v_temp_blob BLOB;