Skip to content

Instantly share code, notes, and snippets.

View KevOrr's full-sized avatar
💣
status' OR 1=1; --

Kevin Orr KevOrr

💣
status' OR 1=1; --
View GitHub Profile
@KevOrr
KevOrr / ordinal-incrementy-eta.user.js
Last active July 14, 2020 17:10
Ordinal Markup - Incrementy upgrade ETA
// ==UserScript==
// @name Ordinal Markup - Incrementy upgrade ETA
// @namespace https://kevorr.com
// @version 0.5
// @description Shows estimated time until incrementy upgrades on hover
// @author Kevin Orr
// @match https://patcailmemer.github.io/Ordinal-Markup/
// @grant none
// @downloadURL https://gist.githubusercontent.com/KevOrr/43b10b3bd731b57a8879ac78e4457f96/raw/ordinal-incrementy-eta.user.js
// @updateURL https://gist.githubusercontent.com/KevOrr/43b10b3bd731b57a8879ac78e4457f96/raw/ordinal-incrementy-eta.user.js
@KevOrr
KevOrr / strip.lua
Last active October 22, 2019 19:58
ComputerCraft strip miner script
local args = {...}
-- minimum fuel level before returning to refuel
local MINIMUM_FUEL = 2048
if not #args == 0 then
print("Usage: strip")
return
end
@KevOrr
KevOrr / README.md
Created August 31, 2019 23:33
CPpython re performance

Performace of various CPython regexpressions in searching for a substring close to the end of a string

What makes sense to me:

  • patX_1: They are all constant-time since the greedy .* will effectively make the search start at the end
  • patX_2: The non-greedy .*? causes search to start at the beginning of the strings, making this a linear-time operation
  • patX_3: With only a plain pattern, re.search is essentially a non-greedy search, making this also a linear-time operation
@KevOrr
KevOrr / output.txt
Created June 4, 2018 03:40
Floating Point Weirdness
f1: 0.707106769084930419921875 f3 04 35 3f
f2: 0.707106769084930419921875 f3 04 35 3f
f3: 0.707106769084930419921875 f3 04 35 3f
d1: 0.707106781186547572737311 cd 3b 7f 66 9e a0 e6 3f
d2: 0.707106781186547461715008 cc 3b 7f 66 9e a0 e6 3f
l1: 0.707106781186547572737311 00 68 de f9 33 f3 04 b5 fe 3f 00 00 00 00 00 00
l2: 0.707106781186547524436104 85 64 de f9 33 f3 04 b5 fe 3f 40 00 00 00 00 00
@KevOrr
KevOrr / baseDown.hs
Created May 15, 2018 00:17
Take n largest items Haskell
module CodeWars.Largest (largest) where
import Data.List (sortBy, sort)
import Data.Ord (comparing, Down)
largest :: Ord a => Int -> [a] -> [a]
largest n xs = sort $ take n $ sortBy (comparing Down) xs
-- Line 6 causes compilation error:
-- • Data constructor not in scope: Down :: a -> a0
-- • Perhaps you want to add ‘Down’ to the import list
@KevOrr
KevOrr / SKI.sml
Created April 17, 2018 08:50
Untyped Lambda Calculus to SKI Combinator Calculus
datatype lambdaExpr =
Var of string
| Abs of string * lambdaExpr
| App of lambdaExpr * lambdaExpr;
datatype skiExpr =
S
| K
| I
| SKIApp of skiExpr * skiExpr;
@KevOrr
KevOrr / bintree.hs
Last active January 29, 2018 11:15
64-deep binary tree
data Tree a = Leaf a | Node (Tree a) (Tree a)
data Direction = L | R
make :: Integer -> Tree Int
make 1 = Leaf 0
make n = Node (make (n - 1)) (make (n - 1))
get :: Tree a -> [Direction] -> a
get (Node x _) (L:idxs) = get x idxs
get (Node _ y) (R:idxs) = get y idxs
@KevOrr
KevOrr / Language popularity
Last active August 8, 2017 01:35
Github Repos reports
Number of repositories where language is in the top 10 languages used
by that repository by bytes written
Repository count: 178220
id | name | top 10 appearances | top 10 appearances (%)
-----+--------------------------+--------------------+------------------------
1 | JavaScript | 65907 | 36.981%
3 | HTML | 44424 | 24.926%
5 | Shell | 39855 | 22.363%
@KevOrr
KevOrr / 7mNz
Created August 7, 2017 18:58
dpastes for Github GraphQL API support forum
query($owner:String!, $name:String!) {
repository(owner: $owner, name: $name) {
stargazers(first: 2, orderBy: {field: STARRED_AT, direction: DESC}) {
nodes {
...userExpand
}
}
}
}
fragment userExpand on User {
@KevOrr
KevOrr / pairwise_search.py
Last active March 27, 2022 19:01
Grepair
#!/usr/bin/env python3
import re
import operator as op
import itertools as it
import sys
def get_positions(text, patterns_a, patterns_b):
position_lists = [tuple((m.start(),m.end()) for p in ps
for m in re.finditer(p, text, re.IGNORECASE) if m)