Skip to content

Instantly share code, notes, and snippets.

#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#define BUFSIZE (1023 * 1024 * 4)
#define HISTSIZE (0x7f - ' ')
typedef struct hist_entry_s {
uint64_t count;
char codepoint;
@xorgy
xorgy / comeonman.js
Last active January 13, 2017 01:35 — forked from CatTail/htmlentity.js
Javascript: encode(decode) html text into html entity
// encode(decode) html text into html entity
function decodeHtmlEntity(str) {
return str.replace(/&#(\d+);/g, function(match, dec) {
return String.fromCharCode(dec);
});
};
function encodeHtmlEntity(str) {
var buf = '';
for (var i = 0; i < str.length; i++) {
@xorgy
xorgy / spherical.scm
Last active December 21, 2015 18:18
Util for converting between Cartesian coordinates and spherical coordinates(with the physics symbolic convention).
(define (xyz->ρ x y z)
(sqrt (+
(expt x 2)
(expt y 2)
(expt z 2))))
(define (zρ->θ z ρ)
(acos (/ z ρ)))
(define (yx->φ y x)
export MARKPATH=$HOME/.marks
function jump {
cd -P $MARKPATH/$1 2>/dev/null || echo "No such mark: $1"
}
function mark {
mkdir -p $MARKPATH; ln -s $(pwd) $MARKPATH/$1
}
function unmark {
rm "$MARKPATH/$1"
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@xorgy
xorgy / pts.svg
Last active September 16, 2015 12:02
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.