Skip to content

Instantly share code, notes, and snippets.

View dsmrt's full-sized avatar
🤙
❤️

Damien Smrt dsmrt

🤙
❤️
View GitHub Profile
@dsmrt
dsmrt / log-bucket-policy.json
Created July 13, 2022 20:25
aws application loadbalancer s3 bucket policy for access logging
{
"Version": "2012-10-17",
"Id": "AWSConsole-AccessLogs-Policy",
"Statement": [
{
"Sid": "AWSConsoleStmt",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::${AwsAccount}:root"
},
@dsmrt
dsmrt / s3-select-nodejs.js
Last active February 9, 2022 22:19
S3 Select Nodejs example
// make sure to add this dependency
// npm i @aws-sdk/client-s3
const s3lib = require("@aws-sdk/client-s3");
const util = require("util");
const s3 = new s3lib.S3Client({
region: process.env.AWS_REGION || "us-east-1",
});
/**
@dsmrt
dsmrt / my-command.ts
Last active April 16, 2024 19:36
Yargs Typescript CommandModule Generics
import { CommandModule, Argv, Options, ArgumentsCamelCase } from 'yargs'
export interface MyOptions extends Options {
interactive: boolean
env: string
color: string
}
export class MyCommand<U extends MyOptions> implements CommandModule<{}, U> {
public command = 'my-cmd'
SELECT justify_interval(
('2020-12-31'::TIMESTAMP - '2020-01-01'::TIMESTAMP)
)
-- results `1 year 5 days`
@dsmrt
dsmrt / Cvent-GetUpdate-Response.py
Last active April 6, 2020 22:37
Cvent Survey Response Results in `None`
import suds
import os
url="https://api.cvent.com/soap/V200611.ASMX?WSDL"
client = suds.client.Client(url)
print(client)
login = client.factory.create('Login')
login.AccountNumber = os.environ['ACCOUNT_NUMBER']
login.UserName = os.environ['USER_NAME']
@dsmrt
dsmrt / skeleton.bash
Last active October 27, 2023 16:55
Things I use in Bash scripts a lot
#!/usr/bin/env bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
BRANCH=$(git rev-parse --abbrev-ref HEAD)
@dsmrt
dsmrt / pipe-clipboard-to-vim.sh
Created October 10, 2019 18:07
Pipe minified JSON into vim, prettified
#!/bin/bash
pbpaste | jq . | vim -
@dsmrt
dsmrt / carbon.now.sh
Created October 10, 2019 18:00
Create an image from a gist
#go to this url: https://carbon.now.sh/
@dsmrt
dsmrt / saml-idp.php
Created October 3, 2019 03:48
CraftCMS SAML IdP - SLO Destroy Specified Sessions Setting (within the config directory)
<?php
/**
* @see \flipbox\saml\idp\models\Settings::class
*/
return [
'sloDestroySpecifiedSessions' => true,
];
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "ListAllMyBuckets",
"Effect": "Allow",
"Action": [
"s3:ListAllMyBuckets"
],
"Resource": "*"