Skip to content

Instantly share code, notes, and snippets.

@ondras
ondras / ws-proxy.js
Last active November 25, 2022 17:29
TeaJS Websocket API, backed by node's websocket module
/* tiny glue to brige v8cgi/teajs-based apps with a node websocket module */
var WebSocketServer = require('websocket').server;
var HTTP = require('http');
var HTTPS = require('https');
var fs = require('fs');
var Server = function(ip, port, options) {
this.setDebug(true);
this._options = {
@ondras
ondras / atom.sh
Last active April 19, 2016 19:56
Here, I fixed your Atom editor for you
#!/bin/sh
# So here is the deal: the Atom editor might not get focused when
# activated from other app (terminal, file manager, ...). This behavior
# can be observed with all Chrome-based apps and several window managers.
# This tiny script fixes said behavior by sending an explicit "focus"
# request to the window manager. You will need the "wmctrl" package.
atom "$*"
@ondras
ondras / elm-graph.js
Last active April 4, 2016 12:55
Elm graphviz
// javascript:document.body.appendChild(document.createElement("script")).src="http://bit.ly/1RT8h3o";undefined
function trimDeadNodes(node) {
if (node.isOutput) { return true; }
var liveKids = [];
for (var i = node.kids.length; i--; ) {
var kid = node.kids[i];
if (trimDeadNodes(kid)) { liveKids.push(kid); }
}
@ondras
ondras / a.js
Created September 22, 2015 06:24
node require cache
require("./b.js");
require("console").log("a processing");
@ondras
ondras / bash_prompt.sh
Last active May 14, 2021 15:30 — forked from bradsokol/bash_prompt.sh
Set color bash prompt according to active Git or Mercurial branch/bookmark and return status of last command.
#!/bin/bash
#
# DESCRIPTION:
#
# Set the bash prompt according to:
# * the branch/status of the current Git or Mercurial repository
# * the return value of the previous command
#
# USAGE:
#
@ondras
ondras / LICENSE.txt
Last active August 31, 2015 13:51 — forked from 140bytes/LICENSE.txt
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2015 Ondrej Zara <ondrej.zara@gmail.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
{
"vertexPositions" : [5.929688,4.125,0,5.387188,4.125,2.7475,5.2971,4.494141,2.70917,5.832031,4.494141,0,5.401602,4.617188,2.753633,5.945313,4.617188,0,5.614209,4.494141,2.844092,6.175781,4.494141,0,5.848437,4.125,2.94375,6.429688,4.125,0,3.899688,4.125,4.97,3.830352,4.494141,4.900664,3.910782,4.617188,4.981094,4.074414,4.494141,5.144727,4.254687,4.125,5.325,1.677188,4.125,6.4575,1.638858,4.494141,6.367412,1.68332,4.617188,6.471914,1.77378,4.494141,6.684522,1.873438,4.125,6.91875,-1.070312,4.125,7,-1.070312,4.494141,6.902344,-1.070312,4.617188,7.015625,-1.070312,4.494141,7.246094,-1.070312,4.125,7.5,-1.070312,4.125,7,-4.007656,4.125,6.4575,-3.859572,4.494141,6.367412,-1.070312,4.494141,6.902344,-3.847676,4.617188,6.471914,-1.070312,4.617188,7.015625,-3.917371,4.494141,6.684522,-1.070312,4.494141,7.246094,-4.014062,4.125,6.91875,-1.070312,4.125,7.5,-6.209063,4.125,4.97,-6.042168,4.494141,4.900664,-6.0725,4.617188,4.981094,-6.217675,4.494141,5.144727,-6.395312,4.125,5.325,-7.591093,4.125,2.7475,-7.464421,4
{"indices":[9,10,11,28,11,10,13,12,10,37,10,12,10,37,29,27,29,37,29,27,26,25,26,27,17,16,15,14,15,16,15,14,31,30,31,14,31,30,1,2,1,30,1,2,0,3,0,2,0,3,4,6,4,3,4,6,5,7,5,6,5,7,8,38,8,7,8,38,41,39,41,38,41,39,42,40,42,39,26,28,29,10,29,28,12,40,37,39,37,40,37,39,36,38,36,39,36,38,35,7,35,38,35,7,34,6,34,7,34,6,33,3,33,6,33,3,32,2,32,3,32,2,30,37,36,27,24,27,36,27,24,25,23,25,24,36,35,24,22,24,35,24,22,23,21,23,22,35,34,22,20,22,34,22,20,21,19,21,20,34,33,20,18,20,33,20,18,19,16,19,18,16,18,14,30,14,18,30,18,32,33,32,18,52,53,54,72,54,53,54,72,71,69,71,72,71,69,70,67,70,69,70,67,68,65,68,67,68,65,66,63,66,65,66,63,64,61,64,63,64,61,62,59,62,61,62,59,60,58,60,59,60,58,74,56,54,55,80,55,54,55,80,83,82,83,80,83,82,85,84,85,82,54,71,80,70,80,71,80,70,79,68,79,70,79,68,78,66,78,68,78,66,77,64,77,66,77,64,76,62,76,64,76,62,75,73,75,62,75,73,44,45,44,73,44,45,43,62,60,73,74,73,60,73,74,45,80,79,82,81,82,79,82,81,84,50,84,81,79,78,81,51,81,78,81,51,50,48,50,51,78,77,51,49,51,77,51,49,48,46,48,49,77,76,49,47,49,76,49,47,4
@ondras
ondras / LICENSE.txt
Created April 6, 2012 18:34 — forked from 140bytes/LICENSE.txt
Sierpinski triangle - 140byt.es
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2012 Ondrej Zara <http://ondras.zarovi.cz/>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@ondras
ondras / f.js
Created November 19, 2010 08:21 — forked from kriskowal/f.js
var ASSERT = require("assert");
var BINARY, Buffer, section, subsection;
exports['test The "binary" module exists'] = function () {
BINARY = require("binary");
};
section = exports['test Constructors'] = {};
section['test A buffer function must exist.'] = function () {