Skip to content

Instantly share code, notes, and snippets.

View FauxFaux's full-sized avatar

Chris West FauxFaux

View GitHub Profile
@FauxFaux
FauxFaux / before.yaml
Created May 29, 2018 15:35
diagnosing swagger allOf
swagger: '2.0'
info:
version: 1.0.0
title: Example API
description: |
blabla
termsOfService: Copyright TEST eG - 2015
contact:
name: [email protected]
license:
@FauxFaux
FauxFaux / compton-colour.glsl
Created December 27, 2017 01:07
compton compositor compatible code for colour correction
/* compton --backend glx --glx-fshader-win "$(cat ~/compton-colour.glsl)" */
uniform sampler2D tex;
/*mProtanopia*/
//static const half3 blindVisionR = float3( 0.20 , 0.99 , -0.19 );
//static const half3 blindVisionG = float3( 0.16 , 0.79 , 0.04 );
//static const half3 blindVisionB = float3( 0.01 , -0.01 , 1.00 );
/*mDeuteranopia*/
//static const half3 blindVisionR = float3( 0.43 , 0.72 , -0.15 );
//static const half3 blindVisionG = float3( 0.34 , 0.57 , 0.09 );
// gcc -Wall -Wextra -O2 guess.c -lcrypto -o guess
#include <openssl/des.h>
#include <stdint.h>
#include <string.h>
int main() {
DES_cblock key_data;
if (!DES_random_key(&key_data)) {
printf("couldn't generate random key");
@FauxFaux
FauxFaux / dpkg-S.c
Created July 12, 2017 16:41
Is hand-written C faster than Python? Yes, yes it is.
// make CFLAGS=-O2 dpkgs && time ./dpkgs /lib/systemd/systemd
#define _POSIX_C_SOURCE 200809L
#define _GNU_SOURCE
#include <stdlib.h>
#include <stdio.h>
#include <dirent.h>
#include <assert.h>
#include <string.h>
cleanup() {
sudo umount a
rm a.img
sudo losetup -d /dev/loop0
}
set -eu
mkdir -p a
truncate -s 128k a.img
mkfs.ext4 a.img >/dev/null 2>&1
use std::collections::HashMap;
use std::collections::hash_map;
#[derive(Debug)]
enum Node {
Dir(HashMap<String, Node>),
File
}
fn add(into: &mut HashMap<String, Node>, remaining: &[String]) {
use std::collections::HashMap;
use std::collections::hash_map;
#[derive(Debug)]
enum Node {
Dir(HashMap<String, Node>),
File
}
fn list_to_tree(from: Vec<Vec<String>>) -> HashMap<String, Node> {
#[macro_use]
extern crate error_chain;
use errors::*;
fn call_john() -> Result<()> {
john::useful()
.chain_err(|| "calling useful")
?;
Ok(())
# grab a load of dbd txt files
# v the maximum size of log to download
./fetch-logs -m 5k --download --delete-outdated -t dbdtxt
# process the logs
cd logs
../has-only.py debian/dbdtxt/unstable/amd64/*
# read out some packages
CBP=$(python3 -c 'import yaml; print(" ".join(pkg for pkg,dat in yaml.load(open("suggested_notes.yml")).items() if "captures_build_path" in dat.get("issues", {})))')
commit 9d2bf90676206957a502e9ec1c3cfe4f4b40b0cc
Author: Chris West (Faux) <[email protected]>
Date: Thu Jun 1 17:01:16 2017 +0000
dynamically allocate EVP_CTX
diff --git a/boxbackup-0.11.1~r2837/debian/control b/boxbackup-0.11.1~r2837/debian/control
index 5cbdba6..d422125 100644
--- a/boxbackup-0.11.1~r2837/debian/control
+++ b/boxbackup-0.11.1~r2837/debian/control