Skip to content

Instantly share code, notes, and snippets.

;; learning The Little Schemer
;; Chapter 1. Toys
(def car first)
(def cdr rest)
(def cons clojure.core/cons)
(def eq? =)
(def list? clojure.core/list?)
(def atom?
(fn [x]
(not (list? x))))
@wardenlym
wardenlym / proj2ram
Created January 27, 2016 07:42 — forked from redguardtoo/proj2ram
script to copy project to tmpfs
#!/bin/sh
if [ -z "$1" ];then
echo "Usage:"
echo " proj2ram proj-name"
echo " proj2ram restore proj-name"
exit 1
fi
@wardenlym
wardenlym / count-bit.c
Created February 25, 2016 02:41
tricky code for count bit
// to count the number of bits set in v
// c accumulates the total bits set in v
unsigned int
count_bit_1(unsigned int v) {
unsigned int c;
for (c = 0; v; c++)
{
v &= v - 1;
}
@wardenlym
wardenlym / mutualY.scm
Last active February 8, 2017 09:20
Y combinator for mutual recursive functions
#lang racket
;; and the end of : https://yinwang0.wordpress.com/2012/04/09/reinvent-y/
;; Exercise: The Y combinator derived from this tutorial only works for direct recursion,
;; try to derive the Y combinator for mutual recursive functions, for example the following two functions even and odd.
(define even
(lambda (x)
(cond
[(zero? x) #t]
@wardenlym
wardenlym / y-combinator.go
Created March 19, 2018 07:49 — forked from wancw/y-combinator.go
Y combinator in Go, runable example: http://play.golang.org/p/xVHw0zoaWX
package main
import "fmt"
type (
tF func(int) int
tRF func(tF) tF
tX func(tX) tF
)
@wardenlym
wardenlym / UnityWebApiExample.cs
Created May 11, 2018 11:58 — forked from heri3x/UnityWebApiExample.cs
Unity3d - webapi client example using UnityWebRequest or HttpWebRequest
// This code is released as public domain, or under the zlib license.
// このコードはパブリックドメインかzlibライセンス、お好きな方で利用してください。
using UnityEngine;
using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
@wardenlym
wardenlym / demo.cs
Created May 14, 2018 11:43
如果去掉msg code 的风格
class Demo
{
class Ret<R>
{
int error = -1;
R res;
}
interface request { }
interface response_of<T> { }
@wardenlym
wardenlym / file0.txt
Created June 11, 2018 07:48 — forked from st0326s/file0.txt
Unity C#で暗号化・復号化 メモ ref: http://qiita.com/satotin/items/6e0dc0a90312c5d474df
using System;
using System.Text;
using System.Security.Cryptography;
namespace Musashi.WebApi_v1.Utility
{
/// <summary>
/// 暗号化・複合化を行う
/// </summary>
public static class Crypt
@wardenlym
wardenlym / audio-api.yaml
Created September 28, 2018 08:49
audio-api
swagger: '2.0'
info:
description: >-
Document for a sample audio api server.
version: 1.0.0
title: Audio API Server
host: audio-api.wardenlym.com
basePath: /v1
In a new folder, enter and accept all the defaults:
npm init
Let us install the development dependencies:
npm install -D typescript
npm install -D tslint
npm install -D nodemon