Skip to content

Instantly share code, notes, and snippets.

View loganpowell's full-sized avatar

Logan Powell loganpowell

  • Metro DC
View GitHub Profile
@loganpowell
loganpowell / flicker-fix.md
Created December 8, 2023 21:01
Fix VSCode Screen Flicker (Mac Apple Silicon)
  1. Open VSCode, cmd + shift + p
  2. Search for Preferences : Configure Runtime Arguments
  3. This will open the argv.json file with startup setting for VSCode.
// This configuration file allows you to pass permanent command line arguments to VS Code.
// Only a subset of arguments is currently supported to reduce the likelihood of breaking
// the installation.
//
// PLEASE DO NOT CHANGE WITHOUT UNDERSTANDING THE IMPACT
@loganpowell
loganpowell / chunks.py
Created August 22, 2023 13:44
Python ML Chunking Algorithm
from sentence_transformers import SentenceTransformer, util
from torch import Tensor
from sklearn.metrics.pairwise import cosine_similarity
from scipy.signal import argrelextrema
import numpy as np
import math
import constants as C
import openai
import os
import json
@loganpowell
loganpowell / jsdom-prerender.js
Created April 27, 2023 12:49 — forked from lovetingyuan/jsdom-prerender.js
use jsdom to prerender simple page.
const jsdom = require("jsdom");
const { JSDOM } = jsdom;
const path = require('path')
const fetch = require('node-fetch')
const finalhandler = require('finalhandler')
const http = require('http')
const serveStatic = require('serve-static')
function createServer (port, root = path.join(__dirname, 'dist')) {
const serve = serveStatic(root)
@loganpowell
loganpowell / README.md
Created September 21, 2022 17:17
shadow-cljs `:esm` target with ESM dependency for node

Using the REPL build-specific

I'm using Calva with VSCode. My steps

  1. watch the build
D:\projects\census\census-geojson (master -> origin) (census-geojson@2.0.0)
λ shadow-cljs watch lib
  1. fire runtime in separate terminal
@loganpowell
loganpowell / segment.json
Created July 5, 2022 18:26
Segment Common Schema
{
"anonymousId": "507f191e810c19729de860ea",
"context": {
"active": true,
"app": {
"name": "InitechGlobal",
"version": "545",
"build": "3.0.1.545",
"namespace": "com.production.segment"
},
@loganpowell
loganpowell / batch_svg_optimize.bat
Last active November 5, 2022 19:40
batch process all svg files in containing folder with scour (Windows `.bat` file)
@Echo off
setlocal ENABLEDELAYEDEXPANSION
echo.
echo This script runs through all the .svg files in the folder within which this file is contained and outputs an optimized version to the 'out' folder here...
:: echo (type q to quit at any question)
echo.
:: count how many files we need to convert before converting!
set /a total=0
@loganpowell
loganpowell / summary_level_dict
Created April 6, 2021 15:24 — forked from ryanpitts/summary_level_dict
Summary level codes for Census and ACS
# Sources:
# http://mcdc2.missouri.edu/pub/data/sf32000/Techdoc/ch4_summary_level_seq_chart.pdf
# http://www2.census.gov/acs2011_1yr/summaryfile/ACS_2011_SF_Tech_Doc.pdf
SUMMARY_LEVEL_DICT = {
"010","United States",
"020","Region",
"030","Division",
"040","State",
"050","State-County",
"060","State-County-County Subdivision",

How to setup AWS lambda function to talk to the internet and VPC

I'm going to walk you through the steps for setting up a AWS Lambda to talk to the internet and a VPC. Let's dive in.

So it might be really unintuitive at first but lambda functions have three states.

  1. No VPC, where it can talk openly to the web, but can't talk to any of your AWS services.
  2. VPC, the default setting where the lambda function can talk to your AWS services but can't talk to the web.
  3. VPC with NAT, The best of both worlds, AWS services and web.
@loganpowell
loganpowell / cors.js
Created March 30, 2020 14:03 — forked from balupton/cors.js
Acheiving CORS via a Node HTTP Server
// Create our server
var server;
server = http.createServer(function(req,res){
// Set CORS headers
res.setHeader('Access-Control-Allow-Origin', '*');
res.setHeader('Access-Control-Request-Method', '*');
res.setHeader('Access-Control-Allow-Methods', 'OPTIONS, GET');
res.setHeader('Access-Control-Allow-Headers', '*');
if ( req.method === 'OPTIONS' ) {
res.writeHead(200);