Skip to content

Instantly share code, notes, and snippets.

View yspreen's full-sized avatar
🦆
Working

Nick Spreen yspreen

🦆
Working
View GitHub Profile
import socket
def get_message_and_remainder(data):
if not data:
return None, data
if data[0] == ":":
parsed = data[1:].split("\r\n")[0]
return int(parsed), data[len(parsed) + 3 :]
@yspreen
yspreen / ffmpeg.sh
Last active December 12, 2022 00:33
ffmpeg -i input output
rm calculator*mp4 ; ls -1 calculator* | while read f; do ffmpeg -i "$f" -c:v hevc_videotoolbox -q:v 65 -tag:v hvc1 -vf "scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:-1:-1:color=black" -s 1920x1080 -r 60 -strict experimental -c:a aac -b:a 128k -ar 48000 -ac 2 "$f.mp4" </dev/null; done
-i my-video.mov -vcodec h264 -acodec mp2
-acodec libvo_aacenc -vcodec libx264 -s 1920x1080 -r 60 -strict experimental
@yspreen
yspreen / DictionaryKeyPath.swift
Last active November 30, 2022 22:41 — forked from dfrib/DictionaryKeyPath.swift
Swift: Reading and writing to (possible) nested dictionaries for a given key path, using a recursive approach
/*
Copyright 2022 @yspreen
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
//
// ContentView.swift
//
// Created by @spreen_co on 11/13/22.
//
import SwiftUI
struct ContentView: View {
var body: some View {
@yspreen
yspreen / style.scss
Created March 22, 2018 20:17
SASS ultimate transition mixin [SCSS]
@function remove-nth($list, $index) {
$result: null;
@if type-of($index) != number {
@warn "$index: #{quote($index)} is not a number for `remove-nth`.";
} @else if $index == 0 {
@warn "List index 0 must be a non-zero integer for `remove-nth`.";
} @else if abs($index) > length($list) {
@warn "List index is #{$index} but list is only #{length($list)} item long for `remove-nth`.";
} @else {
@yspreen
yspreen / create_doppler_service_token.sh
Created July 24, 2022 11:07 — forked from ryan-blunden/create_doppler_service_token.sh
Crate a Doppler Service Token from the Command Line
#!/usr/bin/env bash
# Requires a CLI token
DOPPLER_TOKEN="$(doppler configure get token --plain)" \
DOPPLER_PROJECT="$(doppler configure get project --plain)" \
DOPPLER_CONFIG="$(doppler configure get config --plain)" \
\
SERVICE_TOKEN=$(curl -sS --request POST \
--url https://api.doppler.com/v3/configs/config/tokens \
@yspreen
yspreen / .hyper.js
Created April 15, 2022 07:40
hyper bug
"use strict";
let cursorColor = "#10c2b3";
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// choose either `'stable'` for receiving highly polished,
@yspreen
yspreen / extract-js-map.sh
Created April 11, 2022 05:32
extract-js-map.sh
#!/bin/sh
mapfile="$1"
seq 0 $((`jq -r '.sources | length' "$mapfile"`-1)) | while read n
do
file="$(jq -r ".sources[$n]" "$mapfile")"
dir="$(dirname "$file")"
mkdir -p "$dir"
jq -r ".sourcesContent[$n]" "$mapfile" > "$file"
{
"title": "Asset Metadata",
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Identifies the asset to which this NFT represents"
},
"description": {
"type": "string",
@yspreen
yspreen / reflect.py
Created December 16, 2021 15:02 — forked from huyng/reflect.py
A simple echo server to inspect http web requests
#!/usr/bin/env python
# Reflects the requests from HTTP methods GET, POST, PUT, and DELETE
# Written by Nathan Hamiel (2010)
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
from optparse import OptionParser
class RequestHandler(BaseHTTPRequestHandler):
def do_GET(self):