Skip to content

Instantly share code, notes, and snippets.

@kugland
kugland / naked-instagram.js
Last active December 31, 2019 19:31
Remove overlay above Instagram images and select the highest res img. - GreaseMonkey / TamperMonkey userscript.
// ==UserScript==
// @name Naked Instagram
// @namespace http://www.instagram.com/
// @version 0.1
// @description Remove overlay above Instagram images and select the highest res img.
// @author André Kugland
// @match http*://*.instagram.com/*
// @grant none
// ==/UserScript==
@kugland
kugland / download-youtube-subtitles.js
Last active February 9, 2024 05:20
Download YouTube subtitles (GreaseMonkey/TamperMonkey script)
// ==UserScript==
// @name Download YouTube subtitles
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Now you can download YouTube subtitles
// @author André Kugland
// @match http*://*.youtube.com/*
// @grant none
// @require https://cdn.jsdelivr.net/npm/[email protected]/dist/FileSaver.min.js#sha256=bbf27552b76b9379c260579fa68793320239be2535ba3083bb67d75e84898e18
// ==/UserScript==
@kugland
kugland / crc32.cpp
Last active September 3, 2019 05:07
Primitives for a header-only CRC-32 implementation for MCUs.
#include <stdint.h>
#include <stdio.h>
#include "helper.hpp"
#include "reflect.hpp"
using crc32::impl::bit_sizeof;
using crc32::impl::and_mask;
using crc32::impl::shift;
using crc32::impl::reflect_u8;
@kugland
kugland / micro_rc4.c
Last active July 28, 2019 18:41
RC4 algorithm for microcontrollers
#include "micro_rc4.h"
static char rc4_state[256];
static unsigned char rc4_i, rc4_j;
__attribute__((always_inline)) inline
static void rc4_swap(void)
{
unsigned char rc4_tmp = rc4_state[rc4_i];
rc4_state[rc4_i] = rc4_state[rc4_j];
#include <cstdint>
template<bool Fits8Bit, bool Fits16Bit, bool Fits32Bit>
struct intopt_helper {
using signed_type = std::int64_t;
using unsigned_type = std::uint64_t;
};
template<>
struct intopt_helper<false, false, true> {
@kugland
kugland / reboot-powerbox.py
Created July 24, 2018 22:02
Script para reiniciar o GVT PowerBox — SAGECOM FAST2764
#!/usr/bin/env python3
import requests
import urllib3
from html.parser import HTMLParser
ip = '192.168.25.1'
credentials = ('admin', 'gvt12345')
class SessionIdFinder(HTMLParser):
@kugland
kugland / shell_escape.c
Last active June 18, 2018 01:44
Escapes a string for use with bash shell, formatted as $'...'.
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
/**
* Escapes a string for use with bash shell, formatted as $'...'.
*
* @param input the input string you want to escape.
*
* @return the escaped string (which must be free'd after use).