Skip to content

Instantly share code, notes, and snippets.

View cynecx's full-sized avatar
🌧️
(~˘▾˘)~ 🌧

cynecx cynecx

🌧️
(~˘▾˘)~ 🌧
  • Germany
  • 16:55 (UTC +01:00)
View GitHub Profile
@cynecx
cynecx / .vimrc
Created April 19, 2016 21:41
My crappy .vimrc
set nocompatible
set history=500
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'scrooloose/nerdtree'
@cynecx
cynecx / crypto-js.js
Created November 13, 2016 21:44
crypto-js
;(function (root, factory) {
if (typeof exports === "object") {
// CommonJS
module.exports = exports = factory();
}
else if (typeof define === "function" && define.amd) {
// AMD
define([], factory);
}
else {
@cynecx
cynecx / isolate.sh
Created March 15, 2019 01:05
wireguard & netns (crappy)
#!/usr/bin/env bash
set -e -o pipefail
shopt -s extglob
export LC_ALL=C
CONTAINER=""
INTER_GATEWAY="192.168.30.0/24"
INTER_IP_HOST="192.168.30.1/32"
INTER_IP_CONT="192.168.30.2/32"
@cynecx
cynecx / ns-inet.sh
Created March 17, 2019 22:56 — forked from brauner/ns-inet.sh
Setup a network namespace with Internet access
#!/usr/bin/env bash
set -x
NS="ns1"
VETH="veth1"
VPEER="vpeer1"
VETH_ADDR="10.200.1.1"
VPEER_ADDR="10.200.1.2"
@cynecx
cynecx / gen.rs
Created February 18, 2020 21:33
Quasi self-referential generator
// In the future when Rust supports Rust#69268,
// it might be possible to write 100% safe self-referencial structs with the help of generators.
#![feature(generic_associated_types)]
#![allow(incomplete_features)]
use core::marker::{PhantomData, PhantomPinned};
use core::pin::Pin;
use core::ptr;
@cynecx
cynecx / snippets.sh
Created March 20, 2020 18:51
linux mount/user namespace snippets
mkdir rootfs
cd rootfs
mkdir old_rootfs
mkdir tmp
mkdir usr
mkdir proc
mkdir root
@cynecx
cynecx / smh.js
Last active October 9, 2020 00:30
Fix Github Mobile (iOS Safari - Shortcuts - Run Javascript on Web page)
(function () {
function fixMobileGithub(document) {
Array.from(document.getElementsByClassName("pr-toolbar")).forEach(toolbar => {
toolbar.classList.remove("js-sticky", "js-position-sticky", "is-stuck");
toolbar.style.position = "unset";
toolbar.style.top = "";
toolbar.style.padding = "";
});
Array.from(document.getElementsByClassName("file-header")).forEach(header => {
header.classList.remove("sticky-file-header", "js-position-sticky");
@cynecx
cynecx / procread.c
Created November 22, 2020 20:34
read procfs with fsopen/fsmount (without actually attaching the mount to the visible vfs)
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <cstdint>
#include <sys/types.h>
#include <sys/stat.h>
@cynecx
cynecx / SHA256.cpp
Created February 10, 2021 21:36
SHA256 implementation based on botan's impl for LLVM
#include "llvm/Support/SHA256.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/Host.h"
#include <string.h>
namespace llvm {
#define ROTR(x,n) (((x) >> n) | ((x) << (32 - (n))))