Skip to content

Instantly share code, notes, and snippets.

@chris124567
chris124567 / shortcode.go
Last active July 22, 2023 01:59
Instagram ID Parsing
package api
import (
"encoding/base64"
"fmt"
"strings"
"time"
)
// See https://gist.github.com/sclark39/9daf13eea9c0b381667b61e3d2e7bc11
@chris124567
chris124567 / benchmark.cpp
Last active April 18, 2022 17:29
MATH214 Final Project: Code to Benchmark various Matrix Multiplication Algorithms
#include <benchmark/benchmark.h>
#include <eigen3/Eigen/Dense>
#include <iostream>
using Eigen::MatrixXi;
static MatrixXi naive_multiply(const MatrixXi &A, const MatrixXi &B) {
// result is an n x o matrix
MatrixXi C = MatrixXi::Zero(A.rows(), B.cols());
@chris124567
chris124567 / backlight.c
Last active August 11, 2021 01:20
backlight control program for linux on dell latitude 3510
#include <stdio.h>
#include <stdlib.h>
#define BRIGHTNESS_FILE "/sys/class/backlight/intel_backlight/brightness"
#define MAX_BRIGHTNESS 120000
static void __attribute__((noreturn)) die(const char *msg) {
printf("%s\n", msg);
exit(EXIT_FAILURE);
}
package main
import (
"crypto/sha256"
"fmt"
"hash"
"math/rand"
"os"
"runtime/pprof"
"strconv"
@chris124567
chris124567 / DeriveZeroMBA.cpp
Last active June 13, 2021 23:51
create convoluted MBA expressions that always evaluate to 0. for instance `(a & ~b & ~c | a & ~b & c | a & b & ~c | a & b & c)*1 - (~a & ~b & ~c | a & ~b & ~c | a & ~b & c | a & b & ~c | a & b & c) + (~a & ~b & ~c)` will evaluate to 0 regardless of the values of a, b, or c. code mostly ported from https://github.com/Pusty/Obfuscat/blob/master/ut…
#include <z3++.h>
#include <armadillo>
#include <array>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <functional>
#include <iostream>
#include <numeric>
@chris124567
chris124567 / wsj.sh
Created May 16, 2020 18:46
Download today's Wall Street Journal by manipulating the parameters in the URL for the free last week's copy
#!/bin/sh
DATE=$(date +%Y%m%d)
DIR="${HOME}/Documents/WSJ"
curl -L 'http://ereader.wsj.net/eebrowser/ipad/html5.check.2350/action/php-script/down_full.php' -H 'Connection: keep-alive' -H 'Pragma: no-cache' -H 'Cache-Control: no-cache' -H 'Origin: http://ereader.wsj.net' -H 'Upgrade-Insecure-Requests: 1' -H 'DNT: 1' -H 'Content-Type: application/x-www-form-urlencoded' --data "rules=&pSetup=wallstreetjournal&archiveName=The+Wall+Street+Journal_${DATE}&language=0&edition=The+Wall+Street+Journal&file=0%40%2Fwallstreetjournal%2F${DATE}%2Fpage.pdf" --compressed -o ${DIR}/${DATE}.pdf
'use strict';
!function() {
/**
* @param {?} functionToRunLater
* @return {?}
*/
function storeOffline(functionToRunLater) {
var deferred = this.constructor;
return this.then(function(n) {
return deferred.resolve(functionToRunLater()).then(function() {
@chris124567
chris124567 / WHOIS server by TLD List
Last active June 10, 2021 14:26
I used this python script to download whois information for all TLDs from IANA whois server, then used text manipulation and grep to get the data into the format below
MITSUBISHI:whois.nic.gmo
XN--3BST00M:whois.gtld.knet.cn
PW:whois.nic.pw
MUSEUM:whois.nic.museum
AMERICANFAMILY:whois.nic.americanfamily
RMIT:whois.nic.rmit
MOTORCYCLES:whois.afilias-srs.net
PROPERTIES:whois.nic.properties
STUDY:whois.nic.study
LY:whois.nic.ly
#!/usr/bin/env python3
import os, sys
import json
from http import client
from hashlib import sha256, sha512
from binascii import hexlify
from base64 import b64encode
from json import loads, dumps
email = 'email_here'
/*
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the