- Emil Persson @Humus
- Matt Pettineo @mynameismjp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns x.ratelimit | |
(:require | |
[taoensso.carmine :as car :refer [wcar]] | |
[ring.util.response :as response] | |
[ring.mock.request :as mock]) | |
(:import | |
[java.util Calendar])) | |
;; Util ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn lazy-file-lines [file] | |
(try | |
(letfn [(helper [rdr] | |
(lazy-seq | |
(if-let [line (.readLine rdr)] | |
(cons line (helper rdr)) | |
(do (.close rdr) nil))))] | |
(helper (clojure.java.io/reader file))) | |
(catch Exception e nil))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LIBRARY user32 | |
EXPORTS | |
UserGetPrecisionTouchPadConfiguration @2548 | |
UserSetPrecisionTouchPadConfiguration @2549 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; ====================================================================================== | |
;; # Uses the Berkeley simple stk package for the `bf` and `se`. | |
;; ====================================================================================== | |
(define (reduce-berk f start coll) | |
(define (iter rest ret) | |
(if (empty? rest) | |
ret | |
(iter (bf rest) (f ret (first rest))))) | |
(iter coll start)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Uses Berkeley's (sentence) helper - slow after 1-5k, but supports larger range than `range-se-recur` | |
(define (range-se-iter start end) | |
(define (iter c ret) | |
(if (= c end) | |
ret | |
(iter (+ c 1) (se ret c)))) | |
(iter start '())) | |
; Uses Berkeley's (sentence) helper - quite slow after 1-5k, seg faults around 1-15k | |
(define (range-se-recur start end) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; outlet code for implementing traditional macro expansion | |
;; macros | |
(define (expand form) | |
(cond | |
((variable? form) form) | |
((literal? form) form) | |
((macro? (car form)) | |
(expand ((macro-function (car form)) form))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef AUGMENTED_C_GUARD | |
#define AUGMENTED_C_GUARD | |
#include <stddef.h> | |
typedef ptrdiff_t isize; | |
#define offset_of(Type, element) ((isize)&(((Type *)0)->element)) | |
#define JOIN2_IND(a, b) a##b | |
#define JOIN2(a, b) JOIN2_IND(a, b) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define BINKGL_LIST \ | |
/* ret, name, params */ \ | |
GLE(void, LinkProgram, GLuint program) \ | |
GLE(void, GetProgramiv, GLuint program, GLenum pname, GLint *params) \ | |
GLE(GLuint, CreateShader, GLenum type) \ | |
GLE(void, ShaderSource, GLuint shader, GLsizei count, const GLchar* const *string, const GLint *length) \ | |
GLE(void, CompileShader, GLuint shader) \ | |
GLE(void, GetShaderiv, GLuint shader, GLenum pname, GLint *params) \ | |
GLE(void, GetShaderInfoLog, GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog) \ | |
GLE(void, DeleteShader, GLuint shader) \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Stops the commit if the changes include the word `nocheckin`. | |
if which tput >/dev/null 2>&1; then | |
ncolors=$(tput colors) | |
fi | |
if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then | |
RED="$(tput setaf 1)" | |
GREEN="$(tput setaf 2)" |
OlderNewer