Skip to content

Instantly share code, notes, and snippets.

View dmelo's full-sized avatar

Diogo Oliveira de Melo dmelo

View GitHub Profile
@dmelo
dmelo / eeprom-problem.log
Created June 8, 2018 00:50
DS1307 Problem
0 - (89)
1 - (90)
2 - (65)
3 - (66)
4 - (67)
5 - (68)
6 - (69)
7 - (70)
8 - (71)
9 - (72)
@dmelo
dmelo / phpcs-update-hook
Last active November 9, 2017 11:26
Git update hook script that only accepts the push if all php files updated or added are complient with PSR2
#!/bin/sh
#
# Update hook script that only accepts the push if all php files updated or
# added are complient with PSR2
# --- Command line
refname="$1"
oldrev="$2"
newrev="$3"
@dmelo
dmelo / generatepass.sh
Created June 22, 2017 02:19
Generates password with random chars including lower and upper case alpha, numeric and special chars
#!/bin/bash
[[ $# -eq 1 ]] && N=$1 || N=16
cat /dev/urandom | tr -dc a-zA-Z0-9\!\@\#\$\%\^\&\*\(\)\-\+\=\'\;\: | head -c${a:-$N}
@dmelo
dmelo / docker-cleanup.sh
Created June 7, 2017 14:13
Cleanup unused Docker images, containers and volumes
#!/bin/bash
docker rm -v $(docker ps -a -q -f status=exited)
docker rmi $(docker images -f "dangling=true" -q)
docker run -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/docker:/var/lib/docker --rm martin/docker-cleanup-volumes
@dmelo
dmelo / switch-symlink
Created April 18, 2017 00:05
Switch two symlinks
dmelo@merov2:~/proj2/s3fs-fuse$ ./src/s3fs g2m2-us-prerender ../g2m2-us-prerender -o passwd_file=passwd -d -d -f -o f2 -o curldbg
[CRT] s3fs.cpp:set_s3fs_log_level(254): change debug level from [CRT] to [INF]
[CRT] s3fs.cpp:set_s3fs_log_level(254): change debug level from [INF] to [DBG]
[INF] s3fs.cpp:set_moutpoint_attribute(4191): PROC(uid=1000, gid=1000) - MountPoint(uid=1000, gid=1000, mode=40775)
FUSE library version: 2.9.7
nullpath_ok: 0
nopath: 0
utime_omit_ok: 0
unique: 1, opcode: INIT (26), nodeid: 0, insize: 56, pid: 0
INIT: 7.25
@dmelo
dmelo / watchdog.sh
Last active May 27, 2016 03:53
watchdog script to reboot my old notebook every time it loses connection with the network router.
#!/bin/bash
function flog() {
DATE=$(date)
echo "$DATE - $1"
}
function freboot() {
echo "TIME TO REBOOT"
/usr/sbin/reboot
@dmelo
dmelo / m.sh
Last active February 18, 2023 09:35
Shell script to control multiple displays.
#!/bin/bash
# check the main display with xrandr and change this accordingly.
MAIN_DP=eDP1
xrandr --output $MAIN_DP --mode 1920x1080
# list of possible displays. (I have a set of adapters, each is addressed with
# a different name)
LIST=$(xrandr | grep connected | cut -d\ -f 1)
@dmelo
dmelo / iwlwifi log
Created December 9, 2015 01:06
Part of iwlwifi log with debuggin enabled on a Dell XPS13 L322X A10
[ +0.204696] iwlwifi 0000:01:00.0: I iwl_pcie_enqueue_hcmd Sending command SENSITIVITY_CMD (#a8), seq: 0x0966, 52 bytes at 102[6]:9
[ +0.203909] iwlwifi 0000:01:00.0: I iwl_pcie_enqueue_hcmd Sending command SENSITIVITY_CMD (#a8), seq: 0x0967, 52 bytes at 103[7]:9
[ +0.817688] iwlwifi 0000:01:00.0: I iwl_pcie_enqueue_hcmd Sending command SENSITIVITY_CMD (#a8), seq: 0x0968, 52 bytes at 104[8]:9
[ +0.100661] iwlwifi 0000:01:00.0: I iwl_pcie_enqueue_hcmd Sending command SENSITIVITY_CMD (#a8), seq: 0x0969, 52 bytes at 105[9]:9
[ +0.204194] iwlwifi 0000:01:00.0: I iwl_pcie_enqueue_hcmd Sending command SENSITIVITY_CMD (#a8), seq: 0x096A, 52 bytes at 106[10]:9
[ +0.204959] iwlwifi 0000:01:00.0: I iwl_pcie_enqueue_hcmd Sending command SENSITIVITY_CMD (#a8), seq: 0x096B, 52 bytes at 107[11]:9
[ +0.101380] iwlwifi 0000:01:00.0: I iwl_pcie_enqueue_hcmd Sending command SENSITIVITY_CMD (#a8), seq: 0x096C, 52 bytes at 108[12]:9
[ +0.102209] iwlwifi 0000:01:00.0: I iwl_pcie_enqueue_hcmd Sending command SENSITIVITY_CM
'use strict';
// Add ECMA262-5 method binding if not supported natively
//
if (!('bind' in Function.prototype)) {
Function.prototype.bind= function(owner) {
var that= this;
if (arguments.length<=1) {
return function() {
return that.apply(owner, arguments);