Skip to content

Instantly share code, notes, and snippets.

<?php
// Quick script to get some not-cryptographically-secure random data
// to stdout in a portable way. Useful for generating uncompressable
// test files
define("INTS_PER_LOOP", 4096);
$f = str_repeat("l", INTS_PER_LOOP);
$r = []; // Using SplFixedArray is actually slower
#!/bin/sh
# Rebuilds flex to avoid the following:
# flex-2.5.39: loadlocale.c:130: _nl_intern_locale_data:
# Assertion `cnt < (sizeof (_nl_value_type_LC_TIME) / sizeof (_nl_value_type_LC_TIME[0]))' failed.
# Aborted (core dumped)
# --
# Run this in your repo root after a repo sync
# Tested on Ubuntu 18.04.02 LTS
@kmark
kmark / pi_bashrc.sh
Last active October 6, 2023 15:31
Modified RetroPie bashrc for general Raspberry Pi use.
# MODIFIED RETROPIE PROFILE START
# Source: https://github.com/RetroPie/RetroPie-Setup/blob/cc1f125c8f79d68b2d9393d21d992a7440b09085/scriptmodules/supplementary/bashwelcometweak.sh
function getIPAddress() {
local ip_route
ip_route=$(ip -4 route get 8.8.8.8 2>/dev/null)
if [[ -z "$ip_route" ]]; then
ip_route=$(ip -6 route get 2001:4860:4860::8888 2>/dev/null)
fi
[[ -n "$ip_route" ]] && grep -oP "src \K[^\s]+" <<< "$ip_route"
@kmark
kmark / mtrandout.php
Last active January 30, 2019 09:19
Does about 15 MiB/s on my machine
#!/usr/bin/env php
<?php
mt_srand(random_int(PHP_INT_MIN, PHP_INT_MAX));
while (true) {
$a = [];
for ($i = 0; $i < 10000; $i++) {
$a[] = mt_rand_short();
}
#!/usr/bin/env php
<?php
/*
* Screencast.com Account Media Downloader
*
* Copyright 2018 Kevin Mark
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

Keybase proof

I hereby claim:

  • I am kmark on github.
  • I am kmark (https://keybase.io/kmark) on keybase.
  • I have a public key ASD87DuZhJZvhUxayBp3iBYimHH-qy9qOdbY6yIhnFt3Wgo

To claim this, I am signing this object:

// https://www.reddit.com/r/programmingcirclejerk/comments/8f7gjg/psa_there_are_over_1000_people_in_the_us_named/dy1c4ey/
fn main() {
const JERK: &str = "INFINITY";
fn exaggerate(mut acc: String, ch: char) -> String {
acc.push(ch);
acc.push(' ');
acc
}
; https://www.reddit.com/r/programmingcirclejerk/comments/8ebz88/the_major_difference_between_java_and_golang_is/dxuq7l0/
(defun square-val (x y str len)
(cond
((eql y 0) (elt str x))
((eql x 0) (elt str y))
((and (eql x len) (eql y len)) (elt str 0))
((eql y len) (elt str (- len x)))
((eql x len) (elt str (- len y)))
(t #\Space)))
From 6a13d2435af223a6164734b3e9255d686578e5c2 Mon Sep 17 00:00:00 2001
From: Kevin Mark <[email protected]>
Date: Sat, 8 Jul 2017 19:45:21 -0400
Subject: [PATCH] Allow entire file to match or first 10241 bytes
---
test/test_download.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/test/test_download.py b/test/test_download.py
@kmark
kmark / extractMotionPhotos.sh
Last active November 3, 2020 14:38
Samsung Galaxy Motion Photo extraction tool
#!/bin/bash
# Copyright 2017 Kevin Mark
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#