Skip to content

Instantly share code, notes, and snippets.

View juliangruber's full-sized avatar

Julian Gruber juliangruber

View GitHub Profile
@egmontkob
egmontkob / Hyperlinks_in_Terminal_Emulators.md
Last active April 17, 2024 01:21
Hyperlinks in Terminal Emulators
# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
#
# Update 7 Oct 2010:
# - This example does *not* appear to work with Chrome >=6.0. Apparently,
# the WebSocket protocol implementation in the cramp gem does not work
# well with Chrome's (newer) WebSocket implementation.
#
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby
'use strict';
// run using this fork of NodeJS
// https://github.com/targos/node/commits/v8-5.4 (https://github.com/nodejs/node/pull/8317)
//
// node --harmony_async_await await_thenables.js
function counter(count) {
return {
then: function(res, rej) {

High level style in javascript.

Opinions are like assholes, every one has got one.

This one is mine.

Punctuation: who cares?

Punctuation is a bikeshed. Put your semicolons, whitespace, and commas where you like them.

@juliangruber
juliangruber / README.md
Last active March 24, 2021 02:00
lightweight node-websocketd

node-websocketd

A lightweight node port of websocketd, originally written in go.

Usage

node-websocketd --port=8080 ./count.sh
var cluster = require('cluster');
var PORT = +process.env.PORT || 1337;
if (cluster.isMaster) {
// In real life, you'd probably use more than just 2 workers,
// and perhaps not put the master and worker in the same file.
cluster.fork();
cluster.fork();
cluster.on('disconnect', function(worker) {
@chalmerj
chalmerj / gist:1492384
Created December 18, 2011 04:39
Init script for Graphite carbon-cache
#! /bin/sh
### BEGIN INIT INFO
# Provides: carbon-cache
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: carbon-cache init script
# Description: An init script for Graphite's carbon-cache daemon.
### END INIT INFO
@creationix
creationix / convert.js
Last active March 31, 2020 07:15
Convert a hex string (base-16) to a base-65536 (16-bit) string.
function hexToBase65536(hex) {
var result = "";
for (var i = hex.length ; i > 0; i -= 4) {
result += String.fromCharCode(parseInt(hex.substring(i - 4, i), 16));
}
return result;
}

Dat Core Technical Roadmap

A small roadmap for the core tech in dat. this mostly relates to the core dependencies such as hypercore/hyperdrive and not the cli or dat.land

Implementation

1. Finish random access APIs

Adding var cursor = drive.createByteCursor(file). A cursor api that quickly allows you to seek anywhere in the file content.

show_icons() {
defaults write com.apple.finder CreateDesktop true
killall Finder
}
hide_icons() {
defaults write com.apple.finder CreateDesktop false
killall Finder
}