Skip to content

Instantly share code, notes, and snippets.

View cardoni's full-sized avatar
:bowtie:

Greg Cardoni cardoni

:bowtie:
View GitHub Profile
@cardoni
cardoni / black-slack.css
Created April 8, 2019 17:44
black-slack.css
:root{--primary:#09F;--text:#DDD;--background:#292a31;--background-elevated:#292a31;--color-highlight:#2b6b95;--background-hover:rgba(255,255,255,0.1);--background-light:#AAA;--background-bright:#FFF;--border-dim:#666;--border-bright:#555;--text-bright:#FFF;--text-special:var(--primary);--text-grey:#717274;--scrollbar-background:#787878;--scrollbar-border:#787878;--active-icon:#2b6b95}h1,h2,h3,h4{color:var(--text)}html,body{background:var(--background);color:var(--text)}hr{border:0;border-bottom:1px solid var(--background-elevated)}.popover_mask{background-color:rgba(0,0,0,0.3)}.TeamSidebar,.TeamSidebar .StoplightContainer,.TeamSidebar .TeamSidebar-addArea{background-color:var(--background) !important;box-shadow:var(--background) 1px 1px 25px;color:var(--text);z-index:1}div.client_channels_list_container{background-color:var(--background-elevated) !important;box-shadow:var(--background-elevated) 1px 1px 25px;color:var(--text);z-index:1}nav.p-channel_sidebar{background-color:var(--background-elevated);color:va
@cardoni
cardoni / is_running_in_aws_context.py
Last active December 6, 2018 21:50
How to detect if Python script is running within AWS-ish environments
def is_running_in_aws_context():
aws_environment_identifiers = [
'AWS_LAMBDA_FUNCTION_NAME',
'AWS_SAM_LOCAL',
'LAMBDA_TASK_ROOT'
]
# check each one and return true or false
for env_var_id in aws_environment_identifiers:
env_var_value = os.getenv(env_var_id, 0)
@cardoni
cardoni / black.original.reformatted.css
Last active November 14, 2018 18:26
Slack Dark Theme - Safe CSS Files
body { background: #222; color: #e6e6e6; }
a { color: #949494; }
a:link, a:visited { color: #949494; }
a:hover, a:active, a:focus { color: #c7c7c7; }
hr { border-bottom: 1px solid #424242; border-top: 1px solid #222; }
Verifying my Blockstack ID is secured with the address 17DDwAwYx3kj9DqEgiSXHo8vPL6nf4drws https://explorer.blockstack.org/address/17DDwAwYx3kj9DqEgiSXHo8vPL6nf4drws
Verifying that "cardoni.id" is my Blockstack ID. https://explorer.blockstack.org/name/cardoni.id
@cardoni
cardoni / env.js
Created October 2, 2017 19:48
serverless custom domain setup
// eslint-disable-next-line import/no-extraneous-dependencies
const { argv } = require('yargs');
let { stage = 'dev' } = argv;
module.exports.getDomainName = () => new Promise((resolve, reject) => {
stage = `${stage}`.toLowerCase();
if (!stage || stage == null || stage === 'dev') {
return resolve('dev-api.yourdomain.com');
@cardoni
cardoni / dump-env.sh
Last active August 11, 2017 22:09
Easily Find, Sort, & Dump Environment Variables to Console
#!/usr/bin/env bash
# handy shortcut(s) to dump environment variables to console log
dumpEnvironmentVariables () {
userInput="$1"
if [[ $userInput ]]; then
env | grep -E -i "$userInput" | sort | uniq
else
env | grep -E -i 'aws|node|nvm' | sort | uniq
fi
@cardoni
cardoni / javascript-strings-and-arrays.js
Last active June 29, 2017 09:05
blowing up strings
// <= ES5
const yourString = "your string here";
const yourDesiredArray = yourString.split( '' );
// => [ 'y', 'o', 'u', 'r', ' ', 's', 't', 'r', 'i', 'n', 'g', ' ', 'h', 'e', 'r', 'e' ]
// >= ES6+
const yourString2 = "your string here";
const yourDesiredArray2 = [ ...yourString2 ];
@cardoni
cardoni / webpack.config.js
Last active June 27, 2017 21:31
Serverless Plugin Webpack: Config
module.exports = {
// `serverless-plugin-webpack` is handling the `entry` & `output` configs
// that would normally be found below in a `webpack.config.js` file
target: 'node',
externals: [
/aws-sdk/,
],
module: {
rules: [
{
@cardoni
cardoni / ds_store_killer.sh
Last active June 23, 2017 21:51
DS_Store Utilities for Bash and ZSH
ds_store_files_count () {
print_horizontal_line
printf "Counting '.DS_Store' Files "
printf "."
sleep 0.2
printf "."
sleep 0.2
printf "."
sleep 0.2
printf "."