Skip to content

Instantly share code, notes, and snippets.

View mainiak's full-sized avatar

Jakub Viták mainiak

View GitHub Profile
@GerHobbelt
GerHobbelt / grammar-extract.jison
Last active February 13, 2024 13:50
snip&snap extracts from our major JISON grammar file, showcasing 'code sections' a la BISON plus a few other bits & tricks. Note the %{ ... %} sections which are JISON's 'code sections'. Also note the code following that last '%%' marker: that is another 'code section' - and the most important one.
%options ranges
%options backtrack_lexer
/*
* lexical grammar
* ===============
*
* This section defines the lexer rules for our formula parser. The rules are checked from top to bottom, so order is import
* here!
*
@aras-p
aras-p / preprocessor_fun.h
Last active May 3, 2025 13:47
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
@todgru
todgru / starttmux.sh
Last active September 26, 2024 04:28
Start up tmux with custom windows, panes and applications running
#!/bin/sh
#
# Setup a work space called `work` with two windows
# first window has 3 panes.
# The first pane set at 65%, split horizontally, set to api root and running vim
# pane 2 is split at 25% and running redis-server
# pane 3 is set to api root and bash prompt.
# note: `api` aliased to `cd ~/path/to/work`
#
session="work"
@synaptiko
synaptiko / index.html
Last active December 19, 2015 16:59
LED PWM with Python & Node.js
<!DOCTYPE html>
<html>
<head>
<style>
label {
display: inline-block; width: 20px; height: 20px; float: left; text-align: center;
}
input {
display: inline-block; width: 25%; height: 20px;
}

Redis FAQ or: what you learn when idling in #redis

First: this here is the unofficial FAQ, only containing things that come up by users in the IRC channel #redis on Freenode. There's also a more official FAQ. This document is also available on my site.

X is weird in my instance. Can you help?

Maybe. To better help please give the following info:

  • Output of redis-cli INFO
  • Output of redis-cli CONFIG GET '*'
@mosladil
mosladil / getUserTrafficQuota.php
Last active December 18, 2015 02:48
Kerio Control - Get user traffic quota
<?php
/**
* Kerio Control - Sample Application.
*
* STATUS: In progress, might change in the future
*
* This api is currently under development.
* The api is not intended for stable use yet.
* Functionality might not be fully verified, documented, or even supported.
*
@synaptiko
synaptiko / 8188eu.ko
Last active May 1, 2019 20:23
Useful links related to "hard" linux things when I was experimenting with Raspberry Pi, cross-compilation, emulation etc.
@bradoyler
bradoyler / mapReduce-WordCounter.js
Last active November 6, 2022 01:45
Using Map-Reduce in Javascript: counting words in a string.
// for counting words in a string
var words="Hi there and hello there. Welcome and hello there.";
var wordcnt = words.replace(/[^\w\s]/g, "").split(/\s+/).reduce(function(map, word){
map[word] = (map[word]||0)+1;
return map;
}, Object.create(null));
@3rd-Eden
3rd-Eden / app.js
Last active December 16, 2015 06:59
simple socket htingy
var http = require('http');
var server = http.createServer(function (req, res) {
res.statusCode = 200;
res.end('<script src="/socket.io/socket.io.js"></script>');
});
var io = require('socket.io').listen(server);
io.sockets.on('connection', function (socket) {
@redcap3000
redcap3000 / nodejs-custom-version-openshift-installer.sh
Last active December 15, 2015 19:29
File that loads git://github.com/openshift/nodejs-custom-version-openshift.git in to an openshift app repo. Supply with path to existing openshift repo, or move script into repo root
#!/bin/bash
## Nodejs custom version installer
##
## Ronaldo Barbachano April 2013
## Based on the openshift/nodejscustom-version-openshift repo
##
## Supply with path to existing openshift repo, or move script into
## repo root.
##
## Probably less headaches if this is run immediately after