Skip to content

Instantly share code, notes, and snippets.

View jcburns's full-sized avatar

jcburns jcburns

View GitHub Profile
// Commented version of https://twitter.com/zozuar/status/1441384708441456651
// Google-translated (with some editing) from @gam0022's version
float i, // Ray marching loop counter
e, // Volume density (the smaller the value, the higher the density)
s, // FBM scale (and loop counter)
g, // Ray's distance (also used for tunnel twirl and camera prespective)
k = .01; // Handy constant
// Ray marching loop
@ZevEisenberg
ZevEisenberg / TypedMutableCopying.swift
Last active August 18, 2021 20:37
Adds typed mutable copying to NSMutableCopying conformers
import Foundation
protocol TypedMutableCopying {
associatedtype ConstantVersion
associatedtype MutableVersion
var typedCopy: ConstantVersion { get }
var typedMutableCopy: MutableVersion { get }
}
@simonbs
simonbs / Slack Status.js
Last active November 23, 2021 02:37
Peforms OAuth flow against Slack and sets a Slack Status. Meant to be used with Shortcuts.
// Variables used by Scriptable.
// These must be at the very top of the file. Do not edit.
// icon-color: pink; icon-glyph: user;
// In order to use the script, you must create a Slack app and install it on your workspace. Go here to create your app: api.slack.com/apps
// There's two important configurations you must make to the app:
// 1. Add the users.profile:write scope to the app. This scope is necessary to set a Slack status.
// 2. Add the following redirect URL, so Slack will redirect to Scriptable after authorizing.
// https://open.scriptable.app
// Run the script to grant your newly created app authorization to access your Slack account. After you've done this, you can use the script in Shortcuts.
@staaldraad
staaldraad / awk_netstat.sh
Last active May 9, 2024 01:14
AWK to get details from /proc/net/tcp and /proc/net/udp when netstat and lsof are not available
# Gawk version
# Remote
grep -v "rem_address" /proc/net/tcp | awk '{x=strtonum("0x"substr($3,index($3,":")-2,2)); for (i=5; i>0; i-=2) x = x"."strtonum("0x"substr($3,i,2))}{print x":"strtonum("0x"substr($3,index($3,":")+1,4))}'
# Local
grep -v "rem_address" /proc/net/tcp | awk '{x=strtonum("0x"substr($2,index($2,":")-2,2)); for (i=5; i>0; i-=2) x = x"."strtonum("0x"substr($2,i,2))}{print x":"strtonum("0x"substr($2,index($2,":")+1,4))}'
# No Gawk
# Local
grep -v "rem_address" /proc/net/tcp | awk 'function hextodec(str,ret,n,i,k,c){
@nickkraakman
nickkraakman / ffmpeg-cheatsheet.md
Last active April 23, 2024 20:53
FFmpeg cheat sheet for 360 video

FFmpeg Cheat Sheet for 360º video

Brought to you by Headjack

 
FFmpeg is one of the most powerful tools for video transcoding and manipulation, but it's fairly complex and confusing to use. That's why I decided to create this cheat sheet which shows some of the most often used commands.

 
Let's start with some basics:

  • ffmpeg calls the FFmpeg application in the command line window, could also be the full path to the FFmpeg binary or .exe file
@iharosi
iharosi / useful-osx-commands.md
Last active September 21, 2023 07:25
Useful OS X commands

###Useful OS X commands

  1. App Store Debug menu

    Show

    defaults write com.apple.appstore ShowDebugMenu -bool true
    

    Hide

@willurd
willurd / web-servers.md
Last active May 21, 2024 09:23
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@creationix
creationix / streamtest.js
Created January 1, 2011 08:57
A sample client for creationix/jsonparse that consumes the twitter feed and filters out messages and names
var Parser = require('./jsonparse');
var Http = require('http');
var p = new Parser();
// IMPORTANT, put your username and password in here
var username = "yourTwitterUsername", password = "yourPassword";
var client = Http.createClient(80, "stream.twitter.com");
var request = client.request("GET", "/1/statuses/sample.json", {
"Host": "stream.twitter.com",
"Authorization": (new Buffer(username + ":" + password)).toString("base64")
});