Skip to content

Instantly share code, notes, and snippets.

View ctkdev's full-sized avatar
💭
Attending Microsoft Build 2024

Christopher T. Kwiatkowski ctkdev

💭
Attending Microsoft Build 2024
View GitHub Profile
@ctkdev
ctkdev / JsonPath_FHIR_STU3_Search_Bundle_By_ResourceType.js
Created October 27, 2022 12:23
JsonPath Expression FHIR STU3 JSON Retrieve Specific Resources from a Bundle
$['entry'][*]['resource'].[?(@.resourceType==='Appointment')]
$['entry'][*]['resource'].[?(@.resourceType==='Practitioner')]
$['entry'][*]['resource'].[?(@.resourceType==='Patient')]
@ctkdev
ctkdev / EasternToUTC_2021_2022.sql
Created October 26, 2022 18:22
Time Shift a DateTime in a MySQL Column from US Eastern TZ to UTC for dates in years 2021-2022
# https://www.timeanddate.com/time/change/usa
select dateTimeAccess dateTimeAccessEastern,
CASE
when dateTimeAccess between '2021-03-14 02:00:00' and '2021-11-07 02:00:00' then DATE_FORMAT(
DATE_ADD(dateTimeAccess, INTERVAL 4 HOUR), '%Y-%m-%d %H:%i:%s')
when dateTimeAccess between '2021-11-07 02:00:01' and '2022-03-13 02:00:00' then DATE_FORMAT(
DATE_ADD(dateTimeAccess, INTERVAL 5 HOUR), '%Y-%m-%d %H:%i:%s')
when dateTimeAccess > '2022-03-13 02:00:01' then DATE_FORMAT(
DATE_ADD(dateTimeAccess, INTERVAL 4 HOUR), '%Y-%m-%d %H:%i:%s')
end as dateTimeAccessUTC
@ctkdev
ctkdev / RetrieveDateCreatedFromFirebaseKey.groovy
Created September 16, 2022 14:29
A simple script to get the java.util.Date from a Firebase Key of type -Kl0BTkp24E5yxs_GnZI
Date decode(String id) {
final String PUSH_CHARS = "-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz"
id = id.substring(0, 8)
Long timestamp = 0
for (int i = 0; i < id.size(); i++) {
String c = id.charAt(i).toString()
println "i=$i PUSH_CHARS.indexOf(c)=${PUSH_CHARS.indexOf(c)}"
timestamp = timestamp * 64 + PUSH_CHARS.indexOf(c)
}
return new Date(timestamp)
@ctkdev
ctkdev / IntellijIDEAAthenaHealthAPIAuthenticationBasicAPIAccessTokenRequest.http
Last active July 28, 2021 13:28
Retrieves the Access Token in the same manner as the I/O Docs API Documentation https://developer.athenahealth.com/io-docs with Basic authorization
### Basic authorization with variables.
### https://api.athenahealth.com/oauthpreview/token
### Retrieves the Access Token in the same manner as the I/O Docs API Documentation https://developer.athenahealth.com/io-docs
POST https://api.athenahealth.com/oauthpreview/token
Authorization: Basic YourAthenaClientID YourAthenaClientSecret
Content-Type: application/x-www-form-urlencoded
grant_type=client_credentials&scope=athena/service/Athenanet.MDP.*
# This will trigger a POST and the following Response
@ctkdev
ctkdev / delete_git_submodule.md
Created February 25, 2021 21:16 — forked from myusuf3/delete_git_submodule.md
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@ctkdev
ctkdev / ignore_ssl.groovy
Created January 14, 2020 14:04 — forked from barata0/ignore_ssl.groovy
Ignore SSL certs in groovy
def nullTrustManager = [
checkClientTrusted: { chain, authType -> },
checkServerTrusted: { chain, authType -> },
getAcceptedIssuers: { null }
]
def nullHostnameVerifier = [
verify: { hostname, session ->
//true
hostname.startsWith('yuml.me')
@ctkdev
ctkdev / aws-calculate-total-object-size-in-bucket.sh
Last active January 10, 2018 17:17
Summarizing the total number of Amazon AWS S3 objects in a bucket along with the total size
$ aws s3 ls --summarize --human-readable --recursive s3://bucket-name-o/
# output will look similar to the following:
Total Objects: 5702031
Total Size: 91851.8 GiB
@ctkdev
ctkdev / npm_uninstall.txt
Last active September 16, 2016 13:11
uninstall global npm package
npm uninstall <package_name> -g
or
npm uninstall <package_name> --global
e.g.
npm uninstall angular-cli -g
@ctkdev
ctkdev / AddNodeModuleFromGit.txt
Created August 24, 2016 13:09
Adding a node_module from Github
cd node_modules
git clone https://github.com/valor-software/ng2-bootstrap.git
cd ng2-bootstrap
git checkout feature-branch
npm install
@ctkdev
ctkdev / DropAllTablesInMySQLDatabase.sql
Created April 20, 2016 17:10
DROP all Tables in a MySQL Database With a Query
SET FOREIGN_KEY_CHECKS = 0;
SET GROUP_CONCAT_MAX_LEN=32768;
SET @tables = NULL;
SELECT GROUP_CONCAT('`', table_name, '`') INTO @tables
FROM information_schema.tables
WHERE table_schema = (SELECT DATABASE());
SELECT IFNULL(@tables,'dummy') INTO @tables;
SET @tables = CONCAT('DROP TABLE IF EXISTS ', @tables);
PREPARE stmt FROM @tables;