Skip to content

Instantly share code, notes, and snippets.

View jziggas's full-sized avatar

Joshua Ziggas jziggas

  • Meeplechase
  • Florida
  • 18:59 (UTC -04:00)
View GitHub Profile
@jziggas
jziggas / drop_policies.sql
Created October 3, 2023 14:44
Drop all policies on a given table in PostgreSQL
CREATE OR REPLACE FUNCTION drop_all_policies_on_table(
target_schema text,
target_table_name text
) RETURNS void LANGUAGE plpgsql AS $$
DECLARE
policy_name text;
sql_text text;
BEGIN
FOR policy_name IN (
SELECT policyname
@jziggas
jziggas / openapi.yaml
Created May 2, 2023 18:48
Marvel OpenAPI 3.x Documentation
openapi: 3.0.1
info:
title: gateway.marvel.com
version: Cable
servers:
- url: http://gateway.marvel.com/
tags:
- name: public
paths:
/v1/public/characters:
@jziggas
jziggas / pg.md
Last active April 27, 2023 16:57
Postgres queries

Redshift specific

Models

Show status of a model

show model <name>;

List all models

@jziggas
jziggas / reset.md
Last active April 17, 2023 19:42
delete old databases from mysql
@jziggas
jziggas / index.js
Last active April 14, 2023 19:29
Find all of the nested npm dependencies in your repo that have been end of life'd
// in your repo first run `npm ls -all -json true > PATH/TO/THIS/FILE/deps.json`
// run `node index.js`
const _ = require('lodash');
const fs = require('fs');
const axios = require('axios');
const file = fs.readFileSync('deps.json');
const json = JSON.parse(file);
@jziggas
jziggas / deps.sh
Created April 14, 2023 17:16
Get a flattened list of all nested dependencies inside an NPM based repository
npm ls -all -parseable true | grep -oP '^.*\/\K.*$' | sort -u
@jziggas
jziggas / listening.sh
Created April 4, 2023 14:38 — forked from tasermonkey/listening.sh
Listening
Mac OSX:
listening () {
lsof -Pni | grep '(LISTEN)' | awk 'BEGIN {printf "%-15s %5s %21s\n", "Command", "PID", "PORT"} {printf "%-15s %5s %21s\n", $1,$2,$9}'
}
Linux (if you want non-you processes that are listening):
listening () {
sudo lsof -Pni | grep '(LISTEN)' | awk 'BEGIN {printf "%-15s %5s %21s\n", "Command", "PID", "PORT"} {printf "%-15s %5s %21s\n", $1,$2,$9}'
}
@jziggas
jziggas / epsg.js
Created January 4, 2022 17:44 — forked from yuletide/epsg.js
Proj4js EPSG Definitions as a node module
module.exports = function(Proj4js){
Proj4js.defs["EPSG:3819"] = "+proj=longlat +ellps=bessel +towgs84=595.48,121.69,515.35,4.115,-2.9383,0.853,-3.408 +no_defs";
Proj4js.defs["EPSG:3821"] = "+proj=longlat +ellps=aust_SA +no_defs";
Proj4js.defs["EPSG:3824"] = "+proj=longlat +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +no_defs";
Proj4js.defs["EPSG:3889"] = "+proj=longlat +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +no_defs";
Proj4js.defs["EPSG:3906"] = "+proj=longlat +ellps=bessel +towgs84=682,-203,480,0,0,0,0 +no_defs";
Proj4js.defs["EPSG:4001"] = "+proj=longlat +ellps=airy +no_defs";
Proj4js.defs["EPSG:4002"] = "+proj=longlat +ellps=mod_airy +no_defs";
Proj4js.defs["EPSG:4003"] = "+proj=longlat +ellps=aust_SA +no_defs";
Proj4js.defs["EPSG:4004"] = "+proj=longlat +ellps=bessel +no_defs";

Angular Peformance Guidelines

Runtime strategies

These are the strategies we can use while the application is running in the browser.

Avoid function calls in view templates

Angular's zone can perform change detection every time there is a user interaction on the document, such as during a click, mouse move, timer tick, or http call. Therefore function calls in the template get invoked and recalculated each time this happens. This can add a lot of unnecessary overhead during runtime especially with complex logic or multiple function calls

@jziggas
jziggas / gist:af381e6cc062943c505fd6c5fc7856fc
Created October 28, 2017 23:53
gpg-agent configuration
cat << EOF > ~/.gnupg/gpg-agent.conf
enable-ssh-support
pinentry-program /usr/local/bin/pinentry
default-cache-ttl 600
max-cache-ttl 7200
default-cache-ttl-ssh 1800
max-cache-ttl-ssh 7200
EOF