Skip to content

Instantly share code, notes, and snippets.

View rdnt's full-sized avatar

Anastasios Papalyras rdnt

  • Thessaloniki, Greece
View GitHub Profile
@dansimau
dansimau / bandwidth-usage.sh
Created August 3, 2011 12:31
Display realtime bandwidth usage for a given interface (Linux only)
#!/bin/bash
#
# Display the realtime bandwidth usage for the specified interface.
#
# dsimmons@squiz.co.uk
# 2011-08-03
#
# Number of seconds to average data over
avgsecs=3
@demonixis
demonixis / toggleFullscreen.js
Created March 18, 2013 16:07
A simple function to toggle fullscreen in JavaScript. It work well on Firefox and Webkit browsers.
/**
* Toggle fullscreen function who work with webkit and firefox.
* @function toggleFullscreen
* @param {Object} event
*/
function toggleFullscreen(event) {
var element = document.body;
if (event instanceof HTMLElement) {
element = event;
@lolmaus
lolmaus / _heading-sizes.sass
Created December 6, 2013 14:31
A mixin used to generate heading sizes. You provide min and max heading sizes and it calculates all the sizes in between. The sizes can be calculated proportionally or augmented by a ratio. Note that calculating based on a ratio requires the modular-scale extension.
// Requires modular-scale
=heading-sizes($max-size: 30px, $min-size: 16px, $max-heading: 1, $min-heading: 6, $ratio: 1, $debug: false)
$number-of-headings: $min-heading - $max-heading + 1
$scaled-size-of-max-heading: modular-scale($number-of-headings - 1, $min-size, $ratio)
$coefficient: 0
@if $ratio != 1
@if modular-scale(1, 1, octave()) != 2
@jaceklaskowski
jaceklaskowski / Rough Notes about CQRS and ES.md
Last active August 20, 2024 10:55
Rough Notes about CQRS and ES

Rough Notes about CQRS and ES

Once upon a time…

I once took notes (almost sentence by sentence with not much editing) about the architectural design concepts - Command and Query Responsibility Segregation (CQRS) and Event Sourcing (ES) - from a presentation of Greg Young and published it as a gist (with the times when a given sentence was heard).

I then found other summaries of the talk and the gist has since been growing up. See the revisions to know the changes and where they came from (aka the sources).

It seems inevitable to throw Domain Driven Design (DDD) in to the mix.

@alopresto
alopresto / gpg_git_signing.md
Last active September 10, 2024 17:07
Steps to enable GPG signing of git commits.

If anyone is interested in setting up their system to automatically (or manually) sign their git commits with their GPG key, here are the steps:

  1. Generate and add your key to GitHub
  2. $ git config --global commit.gpgsign true ([OPTIONAL] every commit will now be signed)
  3. $ git config --global user.signingkey ABCDEF01 (where ABCDEF01 is the fingerprint of the key to use)
  4. $ git config --global alias.logs "log --show-signature" (now available as $ git logs)
  5. $ git config --global alias.cis "commit -S" (optional if global signing is false)
  6. $ echo "Some content" >> example.txt
  7. $ git add example.txt
  8. $ git cis -m "This commit is signed by a GPG key." (regular commit will work if global signing is enabled)
@sleepyfox
sleepyfox / net-negative-producers.md
Last active October 2, 2024 08:18
A blog post from @sleepyfox in 2012 on developer productivity and net-negative producers

Net-negative producers

author: @sleepyfox date: 13-May-2012

How on earth could a set-top-box app software development team (basically a simple Linux UI app to parse a programme and stream some video?) have 20 people on it, when surely 4 or 5 should be more than enough?' a friend asked.

In answer I told him the story of when I started on an assignment for Hutchinson 3G in their new posh glass building in Maidenhead, working in the new 3G products division in early 2002 producing what were essentially a bunch of web apps. I asked my boss how many people were working on the project: "350" was his reply. My jaw dropped to the floor. "Don't worry," he said with a smile on his face "all the real work is being done by nine guys working in a back room of the pub over the road. This new glass building is just a decoy to confuse Vodafone and Orange!"

How on earth could it possibly take 350 people (DBAs, Product Managers, Proect Managers, Architects, BAs, QAs, Developers) to produce a bunch of simple web apps? I si

@tduarte
tduarte / publish-ghpages.md
Last active October 2, 2024 10:14
If you need to force push an subtree
git checkout master # you can avoid this line if you are in master...
git subtree split --prefix dist -b gh-pages # create a local gh-pages branch containing the splitted output folder
git push -f origin gh-pages:gh-pages # force the push of the gh-pages branch to the remote gh-pages branch at origin
git branch -D gh-pages # delete the local gh-pages because you will need it: ref
@teknoraver
teknoraver / unixhttpc.go
Last active September 30, 2024 15:12
HTTP over Unix domain sockets in golang
package main
import (
"context"
"flag"
"fmt"
"io"
"net"
"net/http"
"os"
# Certs are for local testing.
certs := api.test api01.test api02.test api03.test \
server.test server01.test server02.test server03.test \
client.test client1.test client2.test client3.test
.PHONY: all
all: | $(foreach c,$(certs),$(addprefix certs/,$(c)).crt)
# destroy private CA key immediately after make completes so it can be
# trusted for local dev.
test -f ca/ca.key && shred -uz -n 1024 ca/ca.key || true
@fortytw2
fortytw2 / determinism.go
Last active September 15, 2024 19:52
shutdown
package main
type Server struct {
shutdown chan struct{}
close chan struct{}
}
func NewServer() *Server {
s := &Server{
shutdown: make(chan struct{}, 0),