Skip to content

Instantly share code, notes, and snippets.

View t0rr3sp3dr0's full-sized avatar

Pedro Tôrres t0rr3sp3dr0

View GitHub Profile
#include <iostream>
constexpr uint8_t m_len = 40;
constexpr uint8_t crc_len = 7;
constexpr uint8_t msb_shift = m_len + crc_len - 1;
constexpr uint8_t g_len = 8;
constexpr uint8_t g_shift = m_len + crc_len - g_len;
constexpr uint8_t g = (1 << 7) | (1 << 3) | (1 << 0); // G(x) = x^7 + x^3 + 1
constexpr uint8_t crc7_impl(uint64_t crc, uint64_t msb, uint64_t msk, uint8_t iter) {
@t0rr3sp3dr0
t0rr3sp3dr0 / console_user.c
Last active July 18, 2022 19:05
https://developer.apple.com/library/archive/qa/qa1133/_index.html clang -framework CoreFoundation -framework SystemConfiguration ./console_user.c
#include <assert.h>
#include <SystemConfiguration/SystemConfiguration.h>
static CFStringRef CopyCurrentConsoleUsername(SCDynamicStoreRef store)
// Returns the name of the current console user, or NULL if there is
// none. store may be NULL, in which case a transient dynamic store
// session is used.
{
CFStringRef result;
public class Delegate: NSObject, URLSessionDelegate {
public func urlSession(_ session: URLSession, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) {
let serverTrust = challenge.protectionSpace.serverTrust!
let exceptions = SecTrustCopyExceptions(serverTrust)
SecTrustSetExceptions(serverTrust, exceptions)
completionHandler(.performDefaultHandling, URLCredential(trust: serverTrust))
}
}
2022-02-14 21:50:03 [ INFO] Vagrant version: 2.2.19
2022-02-14 21:50:03 [ INFO] Ruby version: 2.7.4
2022-02-14 21:50:03 [ INFO] RubyGems version: 3.1.6
2022-02-14 21:50:03 [ INFO] VAGRANT_EXECUTABLE="/opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/bin/vagrant"
2022-02-14 21:50:03 [ INFO] VAGRANT_INSTALLER_EMBEDDED_DIR="/opt/vagrant/embedded"
2022-02-14 21:50:03 [ INFO] VAGRANT_INSTALLER_ENV="1"
2022-02-14 21:50:03 [ INFO] VAGRANT_INSTALLER_VERSION="2"
2022-02-14 21:50:03 [ INFO] VAGRANT_LOG="debug"
2022-02-14 21:50:03 [ INFO] VAGRANT_LOG_TIMESTAMP="1"
2022-02-14 21:50:03 [ WARN] resolv replacement has not been enabled!
@t0rr3sp3dr0
t0rr3sp3dr0 / busybox
Last active January 17, 2022 07:20
busybox-static_1.30.1-7+b2_amd64
@t0rr3sp3dr0
t0rr3sp3dr0 / Hulu-AdBlocker.user.js
Last active July 29, 2024 02:39
Block Ads on Hulu via UserScript
// ==UserScript==
// @name Hulu AdBlocker
// @namespace https://gist.github.com/t0rr3sp3dr0
// @version 0.0.1
// @author t0rr3sp3dr0
// @description Block Ads on Hulu
// @updateURL https://gist.github.com/t0rr3sp3dr0/af7824f6968e5190d276507fa7ac603c/raw
// @downloadURL https://gist.github.com/t0rr3sp3dr0/af7824f6968e5190d276507fa7ac603c/raw
// @match https://www.hulu.com/*
// @run-at document-end
@t0rr3sp3dr0
t0rr3sp3dr0 / dlna_streamer.js
Last active July 21, 2018 22:00
node ./dlna_streamer.js video.mp4
#!/usr/bin/env node
const fs = require('fs');
const os = require('os');
const path = require('path');
const dlnacasts = require('dlnacasts')();
const express = require('express');
const mime = require('mime-types');
const tmp = require('tmp');
const run = (glue, stdin, stdout, stderr) => {
const iframe = document.createElement('iframe');
iframe.setAttribute('style', 'display: none; ');
iframe.src = 'about:blank';
iframe.onload = () => {
iframe.contentWindow.Module = {
preRun: [
() => {
const _in = new TextEncoder('ascii').encode(stdin).values();
iframe.contentWindow.FS.init(() => _in.next().value, null, null);
#!/bin/bash
function DF {
CMD="$(declare -f DF);$(declare -f $1);$1"
gnome-terminal -e "bash -ic '${CMD//\'/\'\"\'\"\'}'"
}
function MAIN {
{
while true; do
echo `expr $RANDOM \% 100`
for (( I = 0; I < 32; ++I )); do
@t0rr3sp3dr0
t0rr3sp3dr0 / ff
Last active October 18, 2017 21:42
This file has been truncated, but you can view the full file.