Skip to content

Instantly share code, notes, and snippets.

@cyfdecyf
cyfdecyf / gen-lut.py
Created December 21, 2023 04:55
Generate 3D LUT
#!/usr/bin/env python
class Lut3DGenerator:
def __init__(self):
pass
def gen_identity_3dlut(self, lut_size, output_fname):
lut_size_f = float(lut_size)
# Generate an identity 3D LUT and write to output file.
@cyfdecyf
cyfdecyf / strtod-test.cpp
Last active April 23, 2021 09:06
strtod inf & nan parsing test
#include <stdio.h>
#include <cstdlib>
#include <cerrno>
#include <limits>
#include <cmath>
#include <cassert>
#include <cstring>
static const char* AtofPrecise(const char* p, double* out) {
char* end;
@cyfdecyf
cyfdecyf / CMakeLists.txt
Created September 11, 2018 06:18
pybind11 TLS test
cmake_minimum_required (VERSION 2.8)
add_subdirectory(pybind11)
pybind11_add_module(test_gil test_gil.cc)
@cyfdecyf
cyfdecyf / tlrecode.sh
Created December 31, 2016 12:42 — forked from NikitaKarnauhov/tlrecode.sh
Shell script to decode and encode TP-LINK router config files
#!/usr/bin/env bash
# tlrecode.sh
# Decode and encode TP-LINK router config files.
#
# Creative Commons CC0 License:
# http://creativecommons.org/publicdomain/zero/1.0/
#
# To the extent possible under law, the person who associated CC0 with this
# work has waived all copyright and related or neighboring rights to this work.
@cyfdecyf
cyfdecyf / variant.cc
Created November 2, 2016 09:55 — forked from tibordp/variant.cc
A simple variant type implementation in C++
#include <iostream>
#include <utility>
#include <typeinfo>
#include <type_traits>
#include <string>
template <size_t arg1, size_t ... others>
struct static_max;
template <size_t arg>
@cyfdecyf
cyfdecyf / git-svn-diff.py
Created December 2, 2015 12:38
Convert git diff to svn patch compatible format.
#!/usr/bin/python
# Author: Chen Yufei
# Convert git diff to svn patch compatible format.
import subprocess
import sys
import re
def check_output(cmd):
#!/bin/bash
#
# git-svn-diff originally by (http://mojodna.net/2009/02/24/my-work-git-workflow.html)
# modified by mike@mikepearce.net
# modified by aconway@[redacted] - handle diffs that introduce new files
#
# Generate an SVN-compatible diff against the tip of the tracking branch
# Get the tracking branch (if we're on a branch)
TRACKING_BRANCH=`git svn info | grep URL | sed -e 's/.*\/branches\///'`
@cyfdecyf
cyfdecyf / bdcurl.sh
Created November 9, 2015 17:09 — forked from meoow/bdcurl.sh
百度云命令行(bash)上传下载脚本
#!/bin/bash
# Baidu Yun Command Line Interface
# Depends: bash, curl, grep, awk, sed, od
# (They are basicly builtin tools of any *nix system.)
# Additionally, fastupload depends: head, wc, md5sum or md5, cksum
# (Which are also builtin tools)
#### Variables ####
@cyfdecyf
cyfdecyf / Makefile
Created September 11, 2015 01:53
Test get and set pipe/fifo buffer size.
pipe-size: pipe-size.o
$(CC) $< -o $@
@cyfdecyf
cyfdecyf / linode-speedtest.sh
Created August 4, 2015 07:53
Linode speedtest
#!/bin/bash
list="
http://speedtest.newark.linode.com/100MB-newark.bin
http://speedtest.atlanta.linode.com/100MB-atlanta.bin
http://speedtest.dallas.linode.com/100MB-dallas.bin
http://speedtest.fremont.linode.com/100MB-fremont.bin
http://speedtest.frankfurt.linode.com/100MB-frankfurt.bin
http://speedtest.london.linode.com/100MB-london.bin
http://speedtest.singapore.linode.com/100MB-singapore.bin