This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Just in case anyone is directed to this page, rather than doing some horribly convoluted solution, the following will work on most systems (even ones that dont have bc and perl) - eg many small devices running busybox. | |
As ahh said - 'awk' is probably your best friend here: | |
# Return the value of an operation | |
float_val() { | |
echo | awk 'END { print '"$1"'; }' | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Comparacao de numeros decimais | |
# ------------------------------------------------------------ | |
# | |
# Verifica se o primeiro parametro e' maior que o segundo. | |
# | |
# Exemplo simples com retorno true/false (0/1): | |
# | |
# x=1.1.2 | |
# y=1.0.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env /bin/sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env /bin/sh | |
ls /lib/modules/`uname -r`/kernel/drivers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Real Time Clock (RTC) Drivers for Linux: https://www.kernel.org/doc/Documentation/rtc.txt | |
cat /proc/driver/rtc | |
# ----------------------------------------x---------------------------------------- | |
echo rtc-pcf8563 0x51 /sys/class/i2c-adapter/i2c-1/new_device | |
# ----------------------------------------x---------------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
i2cget -f -y 1 0x51 0x00 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env /bin/sh | |
find . ! -name 'except_this' -delete |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var re = /(.*)\, (.*)\, (.*)/; | |
var str = "Rua tal, 200, Pato Branco"; | |
var newstr = str.replace(re, "$2"); | |
console.log(newstr); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib2 | |
url = "http://api.example.com" | |
req = urllib2.Request(url) | |
req.add_header("Accept", "application/json") | |
req.add_header("Content-Type", "application/x-www-form-urlencoded") | |
req.add_header("Authorization", "Bearer 591768b9-a3ad-443c-a60c-33ccdabb6cce") | |
res = urllib2.urlopen(req) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>html 5 minimal skeleton</title> | |
<style type="text/css"> | |
body { | |
padding: 40px; | |
} | |
.left-side-0 { |