Skip to content

Instantly share code, notes, and snippets.

View necccc's full-sized avatar

Szabolcs Szabolcsi-Toth necccc

View GitHub Profile
@necccc
necccc / flickr-remove-yahoo-bar.js
Created July 2, 2013 13:12
Userscript to remove the ugly yahoo bar from the top of *.flickr.com
// ==UserScript==
// @match http://*.flickr.com/*
// ==/UserScript==
try {
var eyebrow = document.querySelectorAll('#eyebrow')[0];
eyebrow.parentNode.removeChild(eyebrow);
document.querySelectorAll('body')[0].className = document.querySelectorAll('body')[0].className.replace('with-eyebrow', '');
} catch (e) {}
@necccc
necccc / git shorts
Last active December 25, 2015 06:29
git merge workflow helper
# work branch to feature branch
w2b = "!f() { b=\"$1\"; w=`git status --porcelain -bs|awk 'NR==1{print $2}'`; if [[ ! $w =~ "work" ]]; then echo "Not on a workbranch! Aborting..."; exit 1; fi; git checkout branches/$b; git pull; git merge $w --no-ff; }; if [[ $? == 0 ]]; then git checkout $w; fi; f"
# work branch to feature branch with push
w2bp = "!f() { b=\"$1\"; w=`git status --porcelain -bs|awk 'NR==1{print $2}'`; if [[ ! $w =~ "work" ]]; then echo "Not on a workbranch! Aborting..."; exit 1; fi; git checkout branches/$b; git pull; git merge $w --no-ff; if [[ $? == 0 ]]; then git push; if [[ $? == 0 ]]; then git checkout $w; fi; fi; }; f"
# work branch to master
w2m = "!f() { w=`git status --porcelain -bs|awk 'NR==1{print $2}'`; if [[ ! $w =~ "work" ]]; then echo "Not on a workbranch! Aborting..."; exit 1; fi; git checkout master; git pull; git merge $w --no-ff; if [[ $? == 0 ]]; then git checkout $w; fi; }; f"
# work branch to release tag
@necccc
necccc / gist:9124078
Last active August 29, 2015 13:56 — forked from cyx/gist:3690597
check process redis-server
with pidfile "/var/run/redis/redis-server.pid"
start program = "/etc/init.d/redis-server start"
stop program = "/etc/init.d/redis-server stop"
if 2 restarts within 3 cycles then timeout
if totalmem > 100 Mb then alert
if children > 255 for 5 cycles then stop
if cpu usage > 95% for 3 cycles then restart
if failed host 127.0.0.1 port 6379 then restart
if 5 restarts within 5 cycles then timeout
// npm install mocha sinon chai
// test.js
var assert = require('chai').assert;
var sinon = require('sinon');
var mymodule = require('./mymodule');
suite('mymodule', function () {
me: why dont you let me to ride the metro?
bkv ellenor: nincs jegye!
me: ? excuse me? do you speak english?
bkv ellenor: (speaking slowly) nincs …. jegye…
@necccc
necccc / tito-activites.md
Last active November 20, 2015 15:08
Tito Tickets and Activities

Tito Tickets and "Activities"

The name "Activities" can narrow one’s mindset, think about them as “Constraints” that overlap tickets.

Rule of thumb:

if an Activity count reaches zero, any ticket that is associated with that Activity, is SOLD OUT, zero amount remaining

Expected example ticket setup:

@necccc
necccc / index.html
Created January 25, 2018 16:02
Binary stream example using Fetch
<!DOCTYPE HTML>
<html>
<head>
<title>Binary streaming using Fetch</title>
</head>
<body>
<h1>Binary streaming using Fetch</h1>
<img src="">
@necccc
necccc / random1024.js
Created January 26, 2018 20:45
random 1024 bytes of binary data
const crypto = require('crypto')
const fs = require('fs')
const util = require('util')
const writeFile = util.promisify(fs.writeFile)
const randomBytes = util.promisify(crypto.randomBytes)
void async function () {
const data = await randomBytes(1024)
@necccc
necccc / tito-ticket-overlay.css
Created October 24, 2018 09:16
Tito Ticket overlay custom CSS messages
div.registration_billing_address_vat_number:after {
display: block;
content: "If you buy your ticket as an individial, or you don\'t have an EU VAT number, please enter a number 0 here";
width: 100%;
color: #777;
margin-top: 4px;
margin-bottom: 4px;
font-size: 12px;