Skip to content

Instantly share code, notes, and snippets.

View K-atc's full-sized avatar
:octocat:
Octocatic Days

K_atc K-atc

:octocat:
Octocatic Days
View GitHub Profile
import Data.List
prefixMatch [] _ = True
prefixMatch _ [] = False
prefixMatch (needleHead : needleTail) (strHead : strTail) =
if needleHead == strHead then prefixMatch needleTail strTail
else False
findString needle str =
@yvt
yvt / Spline.h
Created June 22, 2014 11:07
Spline interpolation routines for C++
//
// YSpline (MIT license) by yvt <[email protected]>
//
// -------------
// Quaternion spline interpolation is based on http://qspline.sourceforge.net/qspline.pdf
// -------------
//
#include <functional>
#include <valarray>
@yvt
yvt / asm-red-black-tree.s
Created February 5, 2014 15:25
x86_64 System V呼び出し規約 AT/T記法のアセンブラで赤黒木 (削除は実装していない, 処理速度やコードサイズは未考慮)
#
# x86_64 赤黒木 (System V 呼び出し規約)
# (C) 2013 @YVT, all rights reserved.
#
.global _RedBlack_AllocNode
# .global _RedBlack_FreeNode
# struct TreeDescriptor {
@yvt
yvt / gist:8420170
Created January 14, 2014 15:32
4n桁の2進数を逆順にして16進数にするCプログラム
#include <stdio.h>
#define DIGIT(a) ((a)=='1'?1:0)
void rec(){
int c = getchar();
int c2 = getchar(), c3 = getchar(), c4 = getchar();
if(c < 0) return;
rec();
putchar("0123456789abcdef"[((DIGIT(c4)*2+DIGIT(c3))*2+DIGIT(c2))*2+DIGIT(c)]);
}
void main(){
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
import sys
# RSA Decipher for SECCON CTF 4(Yokohama)
# Author: Matsukuma Hiroki a.k.a. hhc0null <[email protected]>
# Usage: ./RSA_Decipher < [Crypted Text]
@bosmacs
bosmacs / latex.template
Created June 28, 2011 19:39 — forked from michaelt/latex.template
Simple Pandoc latex.template with comments
%!TEX TS-program = xelatex
\documentclass[12pt]{scrartcl}
% The declaration of the document class:
% The second line here, i.e.
% \documentclass[12pt]{scrartcl}
% is a standard LaTeX document class declaration:
% we say what kind of document we are making in curly brackets,
% and specify any options in square brackets.