Skip to content

Instantly share code, notes, and snippets.

Qix Qix-

Block or report user

Report or block Qix-

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Qix-
Qix- / Makefile
Last active Feb 15, 2019
Example of how syscall support could be added to Terra without any dependencies
View Makefile
.PHONY: all
all: bin/test-syscall
bin/test-syscall: test-syscall.t syscall-macos-x64.t
@mkdir -p bin
terra $<
.PHONY: clean
clean:
rm -rf bin
@Qix-
Qix- / icns.cmake
Created Jan 26, 2019
Build an ICNS based off a single PNG (ImageMagick) or SVG image (Inkscape)
View icns.cmake
# LICENSE: CC0 - go nuts.
# Hi :) This is what I used to generate the ICNS for my game, Tide.
# Both input formats (SVG vs PNG) work just fine, but in my experience
# the SVG came out with noticeably better results (although PNG wasn't
# a catastrophe either). The logo for the game was simple enough that
# SVG was indeed an option.
# To use:
#
@Qix-
Qix- / example-http-backend.tf
Created Jan 23, 2019
Example Terraform HTTP backend implementation for Node.js. Stores the state in a local object. Not meant for production, but more to show how one would go about implementing the HTTP api for it since it's not well documented.
View example-http-backend.tf
terraform {
backend "http" {
address = "http://localhost:8080/tfstate"
lock_address = "http://localhost:8080/tfstate"
unlock_address = "http://localhost:8080/tfstate"
}
}
@Qix-
Qix- / voodoo.cc
Created Jan 21, 2019
Accepting any callable as a parameter to a variadic template for any pack of argument types
View voodoo.cc
#include <iostream>
#include <string>
#include <functional>
#include <tuple>
#include <type_traits>
using namespace std;
// This voodoo brought to you by the legendary JLBorges
// http://www.cplusplus.com/forum/general/223816/#msg1025150
@Qix-
Qix- / fn-recasting.cc
Created Jan 21, 2019
Abusing pointer casts to store any function and call it with a parameter pack at runtime
View fn-recasting.cc
#include <iostream>
#include <string>
#include <functional>
#include <tuple>
using namespace std;
template <typename... TArgs>
void cast_apply(function<void()> fn, tuple<TArgs...> tup) {
function<void(TArgs...)> realFn = *reinterpret_cast<function<void(TArgs...)>*>(&fn);
@Qix-
Qix- / asar.js
Created Oct 10, 2018
Tried (and failed) attempt to write an efficient ASAR transformer
View asar.js
/*
This was a tried (and failed) attempt at making an ASAR file
transformer. The ASAR file format is so bizarre and thoughtless
that they used Pickling (lol) and a flat, offset-based data
format with absolutely no formal specification.
For whatever reason, the below code that *should* work does not.
Completely inexplicably, too.
I eventually gave up and resorted to extracting all of the data
@Qix-
Qix- / Alignment.md
Last active Jul 26, 2018
Tests Markdown alignment
View Alignment.md

Lorem

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut in mi tellus. Nulla bibendum eros id ante feugiat molestie. Praesent consequat consectetur risus, non congue risus tempor a. Vestibulum vitae neque at lorem volutpat tempor at a ante. Praesent aliquet nisi vitae lectus placerat, a sodales purus ultrices. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Aliquam erat volutpat. Suspendisse nec ultricies ex, vel congue sem. Proin tincidunt turpis in libero gravida lacinia. Duis sit amet dolor urna.

Curabitur et lorem ut tortor volutpat convallis sollicitudin eget eros. Duis nunc mi, pulvinar a euismod vitae, vulputate vitae nulla. Aliquam consectetur semper molestie. Donec orci felis, bibendum a commodo sodales, eleifend quis lectus. Nullam a sapien quis leo facilisis fringilla. Quisque pharetra libero eu odio rhoncus, nec volutpat sapien tincidunt. P

@Qix-
Qix- / scurl.sh
Last active Oct 20, 2017
Safe cURL - pipe your cURL-obtained scripts into this and pass it a sha256 to verify against. Comes with a pure-bash sha256 implementation.
View scurl.sh
#!/usr/bin/env bash
# Usage: curl https://some-site-with-potential-mitm.com/script.sh | scurl $verified_sha256_digest_of_script
# Released into the Public Domain.
# Written by Josh Junon (josh@junon.me) <github.com/qix->
# Original SHA256 implementation in C by Brad Conte (brad@bradconte.com) <https://github.com/B-Con/crypto-algorithms>
# Ported to (almost) pure Bash by Josh Junon
@Qix-
Qix- / sha256.sh
Last active Jun 14, 2019
SHA256 in (mostly) pure Bash script
View sha256.sh
#!/usr/bin/env bash
# Released into the Public Domain.
#
# Original implementation in C by Brad Conte (brad@bradconte.com) <https://github.com/B-Con/crypto-algorithms>
# Ported to Bash (lol) by Josh Junon (josh@junon.me) <https://github.com/qix->
#
# Yes, it's absolutely as slow as it looks.
#
# The only external dependency it has is on a utility called `od`,
You can’t perform that action at this time.