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
" I like picking a random colorscheme, but I hate the way it's done in most vim scripts | |
" -- localtime(), system("echo $RANDOM"), etc etc. | |
" And I wanted to try this gist thing... | |
function! DevUrandom() | |
let rv = 0 | |
" readline reads 4096 bytes at a time(think fread()) | |
" and returns a *list* of lines. | |
" Don't only read one line because: | |
" - we read more anyway, and | |
" - a short line means 0 has 1/256 probability rather than 1/4G! |
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
" https://groups.google.com/forum/?hl=en&fromgroups=#!topic/sci.physics/SWhCr8SEVWw | |
" TLDR: a PRNG by Dan Bernstein ported to vimscript | |
" The generator shown below is faster than Marsaglia's on my Pentium-100. | |
" It passes the Diehard tests without trouble. | |
" | |
" Use RANDOM for one 32-bit random number. Do not use RANDOM twice in one | |
" line. You can put a 64-bit seed into random_in[2 and 3]. The effect of | |
" seed m is to jump ahead by 2^68 m in a single sequence of period 2^132. | |
" It's easy to determine the seed from the sequence, but not with the sort |
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
#! /bin/sh | |
# Marsaglia's favorite PRNG, see his 20/01/99 post on sci.stat.math at | |
# https://groups.google.com/forum/?fromgroups=#!topic/sci.crypt/yoaCpGWKEk0 | |
# https://en.wikipedia.org/wiki/Random_number_generation#Computational_methods | |
# = API = | |
# marsaglia_seed [w] [z] / both non-zero | |
# marsaglia() returns a random uint32 in $RAND | |
# -- can't use $RANDOM, setting it means seeding the PRNG in bash/ksh/zsh |
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
" http://www.burtleburtle.net/bob/c/readable.c | |
" ---------------------------------------------------------------------------- | |
" readable.c: My random number generator, ISAAC. | |
" (c) Bob Jenkins, March 1996, Public Domain | |
" You may use this code in any way you wish, and it is free. No warrantee. | |
" * May 2008 -- made it not depend on standard.h | |
" ---------------------------------------------------------------------------- | |
" /* a ub4 is an unsigned 4-byte quantity */ | |
" typedef uint32_t ub4 |
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
#! /bin/sh | |
# Original msgs edited or stripped (they were in italian); | |
# iirc knoppix localizes sell scripts, I don't care. | |
zdie() { | |
zenity --error --text="$*" --no-markup | |
exit 123 | |
} |
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
https://github.com/cjdelisle/cjdns/issues/341 | |
1st time I've reported a bug here on github rather than using email or reportbug | |
-- that shows I should use github a little bit^W^Wlot more... |
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
#! /bin/sh | |
# Ispirato dal papa in Sardegna XD | |
# -- per la cronaca, ha finito prima lui, ma di poco. | |
#/* $OpenBSD: arc4.c,v 1.3 2007/09/11 12:07:05 djm Exp $ */ | |
#/* | |
# * Copyright (c) 2003 Markus Friedl <markus@openbsd.org> | |
# * | |
# * Permission to use, copy, modify, and distribute this software for any | |
# * purpose with or without fee is hereby granted, provided that the above | |
# * copyright notice and this permission notice appear in all copies. |
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
Cute little thought: It’s obvious why there aren’t APIs for finding out, for example, the current credentials of the process on the other end of a UNIX-domain socket (there might be several processes on the end!) Less obviously, there could be no process on the other end: suppose you have a socket at your end, and the remote end is dup’ed into two related processes. You pass in an fd (with an SCM_RIGHTS message), then close it. It’s not open in your process, and it can’t be associated with either receiving process (either one of them could read it first). So, who ever’s on the other end of the passed fd is in the unusal situation of having a valid, connected socket with absolutely no process on the other end! Quirky. |
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
/* Digital Mars bug */ | |
/* From stdint.h: | |
#define UINTMAX_MAX 18446744073709551615 | |
... except that "number is not representable": | |
the compiler rejects integer literals bigger than ULONG_MAX, | |
which is 32 bits on windows XD | |
*/ | |
#include <stdint.h> | |
#include <limits.h> |
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
#! /bin/sh | |
# This is my ~/bin/info | |
exec /usr/bin/info "$@" | exec less # linux | |
exec /usr/local/bin/info "$@" | exec less # *BSD | |
# References: | |
# https://news.ycombinator.com/item?id=7072844 | |
# https://news.ycombinator.com/item?id=7075802 | |
# THANK YOU robot_t on ycombinator!!! |
OlderNewer