Skip to content

Instantly share code, notes, and snippets.

View crrobinson14's full-sized avatar

Chad Robinson crrobinson14

View GitHub Profile
@ciiqr
ciiqr / zod-optional-null.ts
Last active July 26, 2024 06:58
zod optional/nullable/nullish differences
// zod schema
z.object({
// valid if string or:
optional: z.string().optional(), // field not provided, or explicitly `undefined`
nullable: z.string().nullable(), // field explicitly `null`
nullish: z.string().nullish(), // field not provided, explicitly `null`, or explicitly `undefined`
});
// type
{
@simov
simov / README.md
Last active July 15, 2024 20:10
Run `node` scripts using `nvm` and `crontab` without hardcoding the node version

Run node scripts using nvm and crontab without hardcoding the node version

cronjob.env.sh

#!/bin/bash

# NVM needs the ability to modify your current shell session's env vars,
# which is why it's a sourced function
@yossorion
yossorion / what-i-wish-id-known-about-equity-before-joining-a-unicorn.md
Last active July 31, 2024 18:47
What I Wish I'd Known About Equity Before Joining A Unicorn

What I Wish I'd Known About Equity Before Joining A Unicorn

Disclaimer: This piece is written anonymously. The names of a few particular companies are mentioned, but as common examples only.

This is a short write-up on things that I wish I'd known and considered before joining a private company (aka startup, aka unicorn in some cases). I'm not trying to make the case that you should never join a private company, but the power imbalance between founder and employee is extreme, and that potential candidates would

import os
import urllib
import json
from checks import AgentCheck
from hashlib import md5
class AccumuloCheck(AgentCheck):
def check(self, instance):
if 'host' not in instance:
@krlicmuhamed
krlicmuhamed / protobuf.js
Last active July 15, 2016 20:25
actionhero socket server with fast protobuf serializer
var net = require('net');
var tls = require('tls');
var path = require('path');
var protobuf = require('protocol-buffers');
var initialize = function(api, options, next) {
var type = 'protobuf';
var attributes = {
pendingShutdownWaitLimit: 5000,
schema: require('fs').readFileSync(path.join(__dirname, 'schema.proto')).toString()
@evantahler
evantahler / server.js
Last active May 28, 2016 17:59
Exploring a node.js memory leak with sending files and setting the Content-Length header
var fs = require('fs');
var http = require('http');
var file = __dirname + '/index.html';
var connections = {};
var idCouner = 0
var port = 8080;
var handleRequset = function(request, response){
idCouner++
var id = idCouner;
#!/usr/bin/env python
import os
import sys
import glob
import argparse
from subprocess import Popen, PIPE, STDOUT
try:
@gene1wood
gene1wood / all_aws_managed_policies.json
Last active July 15, 2024 16:09
A list of all AWS managed policies and they're policy documents as well as a short script to generate the list
This file has been truncated, but you can view the full file.
{
"APIGatewayServiceRolePolicy": {
"Arn": "arn:aws:iam::aws:policy/aws-service-role/APIGatewayServiceRolePolicy",
"AttachmentCount": 0,
"CreateDate": "2019-10-22T18:22:01+00:00",
"DefaultVersionId": "v6",
"Document": {
"Statement": [
{
"Action": [
@Takhion
Takhion / ArcUtils.java
Last active April 11, 2022 02:29
Collection of methods to achieve better circular arc drawing, as Canvas.drawArc() is unreliable. See the related article: https://medium.com/p/9155f49166b8
/**
* ArcUtils.java
*
* Copyright (c) 2014 BioWink GmbH.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@TheMightyLlama
TheMightyLlama / jira-curl.sh
Last active November 16, 2023 18:22
Perform actions on a jira issue via curl
#Creates a new issue with custom fields
curl -D- -u uname:pass -X POST --data "{\"fields\": {\"project\": { \"id\": \"10430\" },\"summary\": \"This is a test issue\", \"description\": \"Description\",\"issuetype\": { \"id\" : \"1\"}, \"components\" : [{\"id\":\"10731\"}], \"customfield_10711\" : [{\"id\":\"10500\"}] } }" -H "Content-Type: application/json" http://localhost:8080/jira/rest/api/2/issue/
#Returns all information for all versions
curl -D- -u uname:pass -X PUT -d "Content-Type: application/json" http://localhost:8080/jira/rest/api/2/project/AN/versions?
#Returns all issues in a version
#This URL requires the version ID of a single version which is provided by the above query
curl -D- -u uname:pass -X PUT -d "Content-Type: application/json" http://localhost:8080/jira/rest/api/2/search?jql=project="AN"+AND+fixVersion='12345'