Skip to content

Instantly share code, notes, and snippets.

@malthejorgensen
malthejorgensen / h264_codec_string_parser.js
Last active February 9, 2022 08:48
H.264 Codec String Parser (video, profile, level) - February 2022
// FROM: https://gist.github.com/eladkarako/119e91525d34db9f61cca23b18fd62a0#file-h264_codec_string_parser-js
//
// Changes:
// 1. Change to work on uppercase strings
// 2. Allow passing codec string as command line argument, e.g. `node h264_codec_string_parser.js avc1.42C03E`
// 3. Parse `constraint_set_flags` as well
//
ISOAVC_MAP = {
"avc1": "H.264"
,"avc2": "H.264"
@malthejorgensen
malthejorgensen / pyproject.toml
Created January 19, 2022 21:47
Cannot install `bleach`-package via git (Poetry issue)
[tool.poetry]
name = "poetry-1-2-0-bleach-issue"
version = "0.1.0"
description = ""
authors = ["Jane Doe <[email protected]>"]
license = "MIT"
readme = "README.md"
packages = [{include = "poetry_1_2_0_bleach_issue"}]
[tool.poetry.dependencies]
@malthejorgensen
malthejorgensen / prompt_hook.fish
Last active December 18, 2021 01:15
auto-updating-fish-prompt
# fish shell: Update both normal prompt and right prompt when executing a command
#
# This hook can be used to ensure e.g. a branch name in the main prompt and
# a timestamp in the right prompt reflects when the command was actually
# run, rather than when the prompt was printed.
#
# This version tries to handle multi-line commands, but doesn't print the
# `fish_right_prompt` when doing so.
function reprint_prompt --on-event fish_preexec
set -l _prompt (fish_prompt)
@malthejorgensen
malthejorgensen / sum-file.rs
Created September 27, 2021 22:39
Summing a file of integers in Rust and Zig
use std::fs::File;
use std::io::prelude::*;
fn main() -> std::io::Result<()> {
let mut file = File::open("foo.txt")?;
let mut contents = String::new();
file.read_to_string(&mut contents)?;
let mut sum: u64 = 0;
for line in contents.lines() {
@malthejorgensen
malthejorgensen / blackhole-email-lists-with-nus.edu.sg.txt
Created July 11, 2017 16:00
Blackhole email lists that include nus.edu.sg
https://www.torvpn.com/en/disposable-email
https://brimconsulting.com/2014/01/17/kens-really-big-list-of-disposable-email-domains/
https://stackoverflow.com/a/33436292/118608
https://thetechhacker.com/2016/02/10/temporary-disposable-email-provider-list/
http://www.idiotinside.com/disposable-temporary-email-address-validation/
https://invisioncommunity.com/forums/topic/391399-disposabletemp-email-addresses/
https://www.torvpn.com/en/disposable-email
https://gist.github.com/adamloving/4401361
https://forums.oneplus.net/threads/temporary-email-domains-that-need-to-be-banned-from-reservation-list.349929/
https://theadminzone.com/threads/list-of-temporary-emails-that-you-should-ban.97784/
@malthejorgensen
malthejorgensen / attachment-modal.php
Created February 6, 2017 08:49
svg-support (Wordpress plugin) - external URL fix
<?php
/**
* Display SVG in attachment modal
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
function bodhi_svgs_response_for_svg( $response, $attachment, $meta ) {
@malthejorgensen
malthejorgensen / jquery-ajax-promise.js
Created August 2, 2016 09:31 — forked from tobiashm/jquery-ajax-promise.js
Wrap jQuery AJAX in ES6 Promise
function AjaxError(jqXHR, textStatus, errorThrown) {
this.name = "AjaxError";
this.message = textStatus;
this.jqXHR = jqXHR;
this.errorThrown = errorThrown;
}
AjaxError.prototype = new Error();
AjaxError.prototype.constructor = AjaxError;
(function($) {
@malthejorgensen
malthejorgensen / Vagrantfile
Created November 9, 2015 07:35
Vagrantfile for Week 10 in "Computational Tools for Big Data"
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = "malthejorgensen/caffe-deeplearning"
# config.vm.provider "virtualbox" do |vb|
# # Display the VirtualBox GUI when booting the machine
# vb.gui = true
#
@malthejorgensen
malthejorgensen / gist:7468656
Created November 14, 2013 15:22
`git diff` of Portal-HttpModule
diff --git a/build/Portal-HttpModule.build b/build/Portal-HttpModule.build
index 065dac8..4395f77 100644
--- a/build/Portal-HttpModule.build
+++ b/build/Portal-HttpModule.build
@@ -18,7 +18,7 @@
targetkind="dll"
logfile="ilmerge.log"
targetplatform="v4"
- targetplatformdirectory="C:\Windows\Microsoft.NET\Framework64\v4.0.30319">
+ targetplatformdirectory="C:\Windows\Microsoft.NET\Framework\v4.0.30319">