Skip to content

Instantly share code, notes, and snippets.

View gyk's full-sized avatar

Yukun Guo gyk

  • Hangzhou, China
  • 20:30 (UTC +08:00)
View GitHub Profile
@ato
ato / debug.clj
Created December 9, 2009 11:42
Simpler debug-repl that works with unmodified Clojure
;; Inspired by George Jahad's version: http://georgejahad.com/clojure/debug-repl.html
(defmacro local-bindings
"Produces a map of the names of local bindings to their values."
[]
(let [symbols (map key @clojure.lang.Compiler/LOCAL_ENV)]
(zipmap (map (fn [sym] `(quote ~sym)) symbols) symbols)))
(declare *locals*)
(defn eval-with-locals
@nyuichi
nyuichi / 90-min-scc.scm
Created July 31, 2011 10:36
The 90 Minute Scheme to C Compiler
#!/usr/local/Gambit-C/bin/gsi
; Copyright (C) 2004 by Marc Feeley, All Rights Reserved.
; This is the "90 minute Scheme to C compiler" presented at the
; Montreal Scheme/Lisp User Group on October 20, 2004.
; Usage with Gambit-C 4.0:
;
; % ./90-min-scc.scm test.scm
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active May 22, 2024 20:20
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@owainlewis
owainlewis / routes.clj
Created January 9, 2013 17:05
Testing Compojure applications in the REPL.
(defroutes app
(GET "/" [] "<h1>Index route</h1>")
(route/not-found "<h1>Page not found</h1>"))
(defn fake-request [routes uri method & params]
(let [localhost "127.0.0.1"]
(routes {:server-port 80
:server-name localhost
:remote-addr localhost
:uri uri
@aaronwolen
aaronwolen / slides.md
Last active November 11, 2022 23:57
Pandoc template to generate reveal.js slideshows.

% Title % Name % Date

My first slide

List

@yyx990803
yyx990803 / api.html
Last active May 19, 2023 23:17
连续请求ajax API回调顺序的问题
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script>
// coolshell api
function xss_ajax(url, callback) {
var script_id = null;
var script = document.createElement('script');
@davidad
davidad / asmrepl.lua
Created March 1, 2014 12:08
Abusing LuaJIT as a REPL for assembly language
-- warning: this is hacky. run at your own risk.
--
-- before you run this, put sum_list.asm in a dynamic library.
--
-- on OSX that means
-- $ nasm -f macho64 sum_list.asm
-- $ libtool -dynamic sum_list.o -o libsum_list.dylib
--
-- on Linux it means
-- $ nasm -f elf64 sum_list.asm
@wyyqyl
wyyqyl / FileVersion.cpp
Created April 8, 2014 09:45
Get file version with WIN32 API
// FileVersion.h: interface for the CFileVersion class.
// by Manuel Laflamme
//////////////////////////////////////////////////////////////////////
#ifndef __FILEVERSION_H_
#define __FILEVERSION_H_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
class CFileVersion {
// Construction
@lifthrasiir
lifthrasiir / README.md
Last active March 5, 2020 12:02
GCJ 2014 QR submission

This is my submission to Google Code Jam 2014 Qualification Round, using Rust programming language. The full description of problems is available at Google.

I've solved all 4 problems over the course of 5 1/2 hours (2014-04-13T05:10+09:00 through T10:40+09:00), which were longer than I've expected (possibly because I was sleepy at that time), but I've got the full credit (90 out of 90) anyway, so I guess it was not so bad move.

I tried to write the idiomatic Rust as much as possible, but not always mostly due to the time constraints. In particular, all program shares same boilerplates for the general structure and I/O which I really don't like.

@Bouke
Bouke / gist:11261620
Last active August 3, 2023 01:46
Multiple Python installations on OS X

Previous versions used homebrew to install the various versions. As suggested in the comments, it's better to use pyenv instead. If you are looking for the previous version of this document, see the revision history.

$ brew update
$ brew install pyenv
$ pyenv install 3.5.0
$ pyenv install 3.4.3
$ pyenv install 3.3.6
$ pyenv install 3.2.6
$ pyenv install 2.7.10

$ pyenv install 2.6.9