Skip to content

Instantly share code, notes, and snippets.

@cyfdecyf
cyfdecyf / strtod-test.cpp
Last active Apr 23, 2021
strtod inf & nan parsing test
View strtod-test.cpp
#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;
View CMakeLists.txt
cmake_minimum_required (VERSION 2.8)
add_subdirectory(pybind11)
pybind11_add_module(test_gil test_gil.cc)
@cyfdecyf
cyfdecyf / tlrecode.sh
Created Dec 31, 2016 — forked from NikitaKarnauhov/tlrecode.sh
Shell script to decode and encode TP-LINK router config files
View tlrecode.sh
#!/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 Nov 2, 2016 — forked from tibordp/variant.cc
A simple variant type implementation in C++
View variant.cc
#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 Dec 2, 2015
Convert git diff to svn patch compatible format.
View git-svn-diff.py
#!/usr/bin/python
# Author: Chen Yufei
# Convert git diff to svn patch compatible format.
import subprocess
import sys
import re
def check_output(cmd):
View git-svn-diff.sh
#!/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 Nov 9, 2015 — forked from meoow/bdcurl.sh
百度云命令行(bash)上传下载脚本
View bdcurl.sh
#!/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 Sep 11, 2015
Test get and set pipe/fifo buffer size.
View Makefile
pipe-size: pipe-size.o
$(CC) $< -o $@
View linode-speedtest.sh
#!/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
@cyfdecyf
cyfdecyf / link-duplicates.rb
Last active Mar 30, 2018
Find duplicate files between two directories and use hardlink to keep only one copy.
View link-duplicates.rb