Skip to content

Instantly share code, notes, and snippets.

View resmo's full-sized avatar
:octocat:

René Moser resmo

:octocat:
View GitHub Profile
@resmo
resmo / progressbar.sh
Created December 7, 2012 15:16
Progress Bar / Spinnter in Bash
#!/bin/bash
sp="⣾⣽⣻⢿⡿⣟⣯⣷"
sp="⠁⠂⠄⡀⢀⠠⠐⠈"
#sp="◢ ◣ ◤ ◥"
#sp="▉▊▋▌▍▎▏▎▍▌▋▊▉"
#sp="▁ ▃ ▄ ▅ ▆ ▇ █ ▇ ▆ ▅ ▄ ▃"
progressbar () {
local processed=$1
@resmo
resmo / next_bind_serial.php
Last active October 13, 2015 00:28
next_bind_serial builder
<?php
class OutOfSerialsException extends Exception {}
function next_bind_serial($serial) {
$today = date("Ymd");
for ($i = 0; $i < 100; $i++) {
$new_serial = $today.sprintf("%02d",$i);
if ($serial < $new_serial) {
@resmo
resmo / model.php
Created July 9, 2012 14:31
optimistic locking first try
<?php namespace Laravel\Database\Eloquent;
use Laravel\Str;
use Laravel\Event;
use Laravel\Database;
use Laravel\Database\Eloquent\Relationships\Has_Many_And_Belongs_To;
abstract class Model {
/**
$ sudo touch /etc/NetworkManager/dispatcher.d/hotspot.sh
$ sudo chmod +x /etc/NetworkManager/dispatcher.d/hotspot.sh
$ sudo echo '#!/bin/bash
IF=$1
STATUS=$2
if [ "$STATUS" = "up" ] && [ "$IF" = "wlan0" ]; then
curl -d "param1=value1&param2=value2" http://example.com/resource.cgi
fi' > /etc/NetworkManager/dispatcher.d/hotspot.sh