Skip to content

Instantly share code, notes, and snippets.

@jklmnn
jklmnn / ssrf_iframe.svg
Created April 4, 2019 23:10 — forked from akhil-reni/ssrf_iframe.svg
SVG Foreign Objects IFrame SSRF
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jklmnn
jklmnn / pylisp.py
Created October 18, 2018 10:45
Python Lisp S-Expression interpreter
#!/usr/bin/env python3
# Python Lisp S-Expression interpreter
#
# Example:
# ./pylisp.py "(+ (* 2 3) 1)" executes (2 * 3) + 1 and yields 7
#
# currently only + - / + and = are supported operations
import sys
@jklmnn
jklmnn / irqtest.c
Created March 9, 2018 15:48
Test hwio irq handler
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include "hwio.h"
@jklmnn
jklmnn / ls.c
Last active December 26, 2019 15:45
#include <sys/types.h>
#include <dirent.h>
#include <stdio.h>
void ls(char *path)
{
DIR *dir;
struct dirent *file;
dir = opendir(path);
@jklmnn
jklmnn / efi_fb.cc
Last active February 11, 2021 19:15
use efi framebuffer from linux user space
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <stdint.h>
#include <unistd.h>
#include "genode.h"
@jklmnn
jklmnn / get_working_sectors.c
Last active September 12, 2017 17:30
Get the working sectors of a block device. Uses the output of bad sectors created by badblocks. Thanks to @nikp123
#include <stdio.h>
int main(int argc, char *argv[]) {
FILE *fp = fopen(argv[1], "rb");
if(!fp) return 1;
int last = 0, bigdiff = 0, num;
while(fscanf(fp, "%d", &num) > 0){
if((num - last) > bigdiff) {
printf("Overthrow: %#x > %#x (%#x-%#x)\n", num-last, bigdiff, last, num);
@jklmnn
jklmnn / preprocessor_fun.h
Created September 2, 2017 20:57 — forked from aras-p/preprocessor_fun.h
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
/*
* Intel ACPI Component Architecture
* AML/ASL+ Disassembler version 20160831-64
* Copyright (c) 2000 - 2016 Intel Corporation
*
* Disassembling to symbolic ASL+ operators
*
* Disassembly of DSDT, Fri May 12 09:26:31 2017
*
* Original Table Header:
@jklmnn
jklmnn / remove-old-kernels.sh
Last active February 2, 2017 13:30
Removes all kernels installed under Debian/Ubuntu that aren't loaded.
#!/bin/bash
kernels=$(dpkg -l | grep -E "ii linux-(image|headers)-[0-9]\.[0-9]\.[0-9]-.*" | grep -v $(uname -r | cut -d"-" -f1,2) | cut -d" " -f3)
echo "Current kernel: $(uname -r)"
echo "Remove kernels:"
echo "$kernels"
read -p "Execute? (y/n)" choice
if [ "$choice" == "y" ]
then
echo $kernels | xargs sudo apt-get remove -y
@jklmnn
jklmnn / dump.py
Last active March 11, 2019 22:20
Dump ParkAPI database.
#!/usr/bin/env python3
import psycopg2 as psql
from sys import argv
import configparser
import os
from urllib.parse import urlparse
from tqdm import tqdm
import csv