Skip to content

Instantly share code, notes, and snippets.

View datfinesoul's full-sized avatar
😲
attempting to absorb infinite amounts of information

Phil Hadviger datfinesoul

😲
attempting to absorb infinite amounts of information
View GitHub Profile
@datfinesoul
datfinesoul / gist:a81e7420e5651d3a0a3a
Last active February 3, 2021 04:07
StatsD Bash UDP Client
#!/bin/bash
#
# Very simple bash client to send metrics to a statsd server
# Example with gauge: ./statsd-client.sh 'my_metric:100|g'
#
# Alexander Fortin <[email protected]>
#
host="${STATSD_HOST:-127.0.0.1}"
port="${STATSD_PORT:-8125}"
@datfinesoul
datfinesoul / gist:0d8fe8c6fac0898620d0
Created January 26, 2015 14:21
Business Days Addition - TSQL
CREATE FUNCTION [dbo].[BusDaysDateAdd]
(
@FromDate datetime,
@DaysToAdd int
)
RETURNS datetime
AS
BEGIN
DECLARE @Result datetime
@datfinesoul
datfinesoul / triangle-selector.less
Created March 31, 2015 17:51
Square with Triangle Selectors
> div.main {
width: 100%;
height: 100%;
outline: 1px solid #eee;
position: relative;
overflow: hidden;
display: inline-block;
> div.hour {
position: absolute;
display: none;
uuid | sed -e 's/-//g' -e 's/^/APP_/'
@datfinesoul
datfinesoul / splunk.md
Created September 2, 2015 19:52
Splunk Notes

SPLUNK & Logging

Tips

  • SET TIMEZONE IN PROFILE

creating a basic saved search

sourcetype=syslog (host=east OR host=europe OR host=asia OR host=jobs) marklar
@datfinesoul
datfinesoul / databases - bit_vs_dates.md
Last active October 23, 2015 22:31
Databases: BITs vs DATEs

BITs vs DATETIMEs for flags

My background has been more in the MSSQL (Microsoft SQL Server) side of relational databases in the past, so I'll use DATETIME and BIT as the data types of the discussion, but it should work the same regardless of DBMS.

Take for example this table:

CREATE TABLE blog.article
(
 article_id INT NOT NULL,
@datfinesoul
datfinesoul / databases - naming_conventions.md
Last active October 23, 2015 22:40
Databases: MSSQL naming conventions for contstraints

MSSQL naming conventions

The best take on this I've seen so far.

Based on a post by Dan Guzman, SQL Server MVP, http://weblogs.sqlteam.com/dang/.

https://social.msdn.microsoft.com/Forums/sqlserver/en-US/76db4119-d040-446e-9ea7-6ba90e017338/naming-conventions-for-constraints?forum=transactsql

Picture a database with a Schema called "In" and another schema called "Out", representing input data and output data respectively. These schema have table names that're the same - for example: each schema has it's own IncomeExpense

@datfinesoul
datfinesoul / ecr.md
Last active June 12, 2020 04:55
ECR Notes

Tag an <untagged> ECR image in China

export AWS_PROFILE="<profile>"
aws ecr get-login-password --region cn-north-1 | \
  docker login --username AWS --password-stdin <account_id>.dkr.ecr.cn-north-1.amazonaws.com.cn
MANIFEST=$( \
  aws ecr batch-get-image --repository-name <ecr_repo_name> \
  --image-ids imageDigest=sha256:<sha> \
  --query 'images[].imageManifest' --output text \
 )
@datfinesoul
datfinesoul / README.md
Last active February 3, 2021 04:16
JS Examples: Failing to use await with async functions

A teaching example to show what happens when you don't have an await on an async method invocation.

Without the away, the program will print:

1612325635779 slowMessage start
1612325635781 leaving program
1612325637784 slowMessage end
@datfinesoul
datfinesoul / README.md
Last active February 15, 2021 13:29
Node.js Generator Async/Await Concurrency Limit

elaborate-example.js

Shows the use of generators to control concurrency. This example illustrates the following.

  • 3 workers running through the data
  • Each piece of "work" takes 200-2000 milliseconds to run
  • The 5th, 10th and 17th item will throw an exception
  • Workers will exit because the exception is unhandled
worker='1' itemnum='0' item='F'