Skip to content

Instantly share code, notes, and snippets.

View resmo's full-sized avatar
:octocat:

René Moser resmo

:octocat:
View GitHub Profile
$ 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
@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 {
/**
@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 / 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 / base.php
Created January 14, 2013 12:31
Laravel 3 base model. I usually use it to extend from it.
<?php
class Base extends Eloquent {
/**
* @var
*/
public static $timestamps = true;
/**
@resmo
resmo / host-test.yml
Created November 15, 2013 13:16
ansible host module testing playbook
---
- hosts: localhost
connection: local
gather_facts: no
remote_user: root
tasks:
- name: test add a record
host: hostname=foobar ip=192.168.123.1
register: result
failed_when: not result.changed
@resmo
resmo / host.md
Last active December 28, 2015 18:19
host module features

change ip

/etc/hosts:

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

task:

@resmo
resmo / check_glue.sh
Last active August 29, 2015 13:57
checks if NS in zone and GLUE record are identical
#!/bin/bash
OK=0
WARNING=1
CRITICAL=2
UNKNOWN=3
domain=$1
if [[ -z "$domain" ]]

Keybase proof

I hereby claim:

  • I am resmo on github.
  • I am resmo (https://keybase.io/resmo) on keybase.
  • I have a public key whose fingerprint is 5826 19B1 A4F6 AE8B C58A D848 8306 965B E6D6 331D

To claim this, I am signing this object:

@resmo
resmo / config
Created May 5, 2015 12:03
Proxy command
Host 10.100.9.* 10.100.209.*
User root
IdentityFile ~/.ssh/id_rsa_cloudstack
StrictHostKeyChecking no
ProxyCommand ssh -q -o ControlPersist=no cloudstack-mgmt.example.com -W %h:3922