Skip to content

Instantly share code, notes, and snippets.

View willowell's full-sized avatar
🤖
Pressing the "do my job" key

William Howell willowell

🤖
Pressing the "do my job" key
View GitHub Profile
@takien
takien / youtubeID.js
Last active May 3, 2024 12:41
Get YouTube ID from various YouTube URL using JavaScript
/**
* Get YouTube ID from various YouTube URL
* @author: takien
* @url: http://takien.com
* For PHP YouTube parser, go here http://takien.com/864
*/
function YouTubeGetID(url){
var ID = '';
url = url.replace(/(>|<)/gi,'').split(/(vi\/|v=|\/v\/|youtu\.be\/|\/embed\/)/);
@domitry
domitry / Barnes-Hut.pde
Last active February 7, 2020 06:44
N-body simulation using Barnes-Hut method and Processing.
import java.awt.geom.Rectangle2D;
import java.awt.geom.Point2D;
public static final int FRAME_X = 1024;
public static final int FRAME_Y = 1024;
public static final int GENERATION_NUM = 4;
public static final int WALL_POWER = 10;
public static final int COFF_COULUMB = 1;
private ArrayList<Body> bodies;
@abhin4v
abhin4v / astar.hs
Last active November 24, 2022 06:36
A* (A star) search in haskell
import qualified Data.PQueue.Prio.Min as PQ
import qualified Data.HashSet as Set
import qualified Data.HashMap.Strict as Map
import Data.Hashable (Hashable)
import Data.List (foldl')
import Data.Maybe (fromJust)
astarSearch :: (Eq a, Hashable a) => a -> (a -> Bool) -> (a -> [(a, Int)]) -> (a -> Int) -> Maybe (Int, [a])
astarSearch startNode isGoalNode nextNodeFn heuristic =
astar (PQ.singleton (heuristic startNode) (startNode, 0))
@kevin-smets
kevin-smets / iterm2-solarized.md
Last active November 14, 2024 15:40
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

@d6y
d6y / kalgn-enum-planets.scala
Last active January 15, 2021 21:17
Planets Example using Klang DIY Enum
/*
The Oracle Java enum Planets example using the Klang DIY Enum, modified to include ordering.
*/
object KlangEnumPlanets extends App {
trait Enum { //DIY enum type
import java.util.concurrent.atomic.AtomicReference //Concurrency paranoia
type EnumVal <: Value //This is a type that needs to be found in the implementing class
@kristopherjohnson
kristopherjohnson / hanoi.hs
Last active August 12, 2020 22:13
Towers of Hanoi in Haskell
#!/usr/bin/env runhaskell
-- Print sequence of moves for 4 discs from pin "A" to pin "C"
main = do putStrLn "Move stack of four discs from A to C:"
printNumberedList moves
where moves = hanoi 4 "A" "C" "B"
-- Return list of moves for moving stack of N discs from one pin to another
hanoi :: Show a => Int -> a -> a -> a -> [String]
hanoi 0 _ _ _ = []
@sindresorhus
sindresorhus / compile-objc.sh
Last active June 25, 2024 10:51
Compile Objective-C on the command-line with clang
# -fobjc-arc: enables ARC
# -fmodules: enables modules so you can import with `@import AppKit;`
# -mmacosx-version-min=10.6: support older OS X versions, this might increase the binary size
clang main.m -fobjc-arc -fmodules -mmacosx-version-min=10.6 -o main
@taniarascia
taniarascia / index.html
Last active October 21, 2024 22:09
HTML Skeleton file
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<meta name="author" content="">
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
@benrules2
benrules2 / Gravity.py
Last active November 14, 2023 16:39
Python N-Body Orbit Simulation
import math
import random
import matplotlib.pyplot as plot
from mpl_toolkits.mplot3d import Axes3D
class point:
def __init__(self, x,y,z):
self.x = x
self.y = y
@stigok
stigok / githook.js
Last active July 8, 2024 14:56
Verify GitHub webhook signature header in Node.js
/*
* Verify GitHub webhook signature header in Node.js
* Written by stigok and others (see gist link for contributor comments)
* https://gist.github.com/stigok/57d075c1cf2a609cb758898c0b202428
* Licensed CC0 1.0 Universal
*/
const crypto = require('crypto')
const express = require('express')
const bodyParser = require('body-parser')