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
#picaxe 08m2 | |
' Odkaz https://gist.github.com/synaptiko/10754510 | |
' Tabulka názvů proměnných, které lze v 08M2 použít: | |
' b0:b1 b2:b3 b4:b5 b6:b7 b8:b9 b10:b11 b12:b13 b14:b15 b16:b17 b18:b19 b20:b21 b22:b23 b24:b25 b26:b27 | |
' w0 w1 w2 w3 w4 w5 w6 w7 w8 w9 w10 w11 w12 w13 | |
' b* = 1 byte, tj. 256 různých hodnot | |
' w* = 2 byty, tj. 65 536 různých hodnot | |
' Kromě těchto dvou jde použít i bit* pro nastavení pouze 2 hodnot (true/false) | |
' Pozor bit0-bit7 se překrývá s b1. Stejně tak b1 a b2 se překrývá s w1. Analogicky je to i pro ostatní proměnné. |
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
#!/bin/sh | |
if [ $# -ge 2 ]; then | |
USER=$1 | |
SERVER=$2 | |
DIR=${MOUNT_SSHFS__ROOT_DIR:-/var/tmp/mount-sshfs}/$SERVER | |
# it's possible to use primary or clip | |
XCLIP_SEL_MODE=${MOUNT_SSHFS__XCLIP_SEL_MODE:-primary} | |
if [ -d $DIR ]; then | |
if [ $# -eq 3 -a "$3" = "kill" ]; then |
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
#!/bin/bash | |
DATE=`date +"%Y%m%d%H%M%S"` | |
INSTALL_DIR=node_${DATE} | |
mkdir $INSTALL_DIR | |
cd $INSTALL_DIR | |
curl http://nodejs.org/dist/node-latest.tar.gz | tar xzv --strip-components=1 | |
export JOBS=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
L.Google = L.Class.extend({ | |
includes: L.Mixin.Events, | |
options: { | |
minZoom: 0, | |
maxZoom: 18, | |
tileSize: 256, | |
subdomains: 'abc', | |
errorTileUrl: '', | |
attribution: '', |
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
<meta http-equiv="content-Type" content="text/html; charset=utf-8" /> | |
<meta http-equiv="content-Language" content="cs" /> | |
<style> | |
div.qr-code { | |
clear: left; | |
} | |
img.qr-code { | |
float: left; | |
margin-bottom: 50px; | |
} |
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
# ... with if/else | |
class Pirate | |
if century > 1700 | |
loot: -> | |
say 'Give me the gold!' | |
else | |
loot: -> | |
say 'Dame el oro!' |
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
http.createServer(function(req, res) { | |
var d = domain.create(); | |
d.add(req); | |
d.add(res); | |
d.on('error', function(er) { | |
console.error('Error', er, req.url); | |
d.dispose(); | |
}); | |
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 bash | |
SCRIPT_PATH=$(readlink -f $0) | |
DIR=$(dirname $SCRIPT_PATH) | |
PID_DIR="${DIR}/pid" | |
LOG_DIR="${DIR}/log" | |
DAEMON_PID_FILE="${PID_DIR}/daemon.pid" | |
DAEMON_LOG_FILE="${LOG_DIR}/daemon.log" | |
PROCESS_PID_FILE="${PID_DIR}/process.pid" |
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
#!/bin/sh | |
wget --output-document=/dev/null http://speedtest.wdc01.softlayer.com/downloads/test500.zip |
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 node | |
var fs = require('fs'); | |
var gpio = require("gpio"); | |
var gpio10 = gpio.export(10, { | |
direction: "out", | |
ready: function() { | |
function readTemperature() { | |
var data = fs.readFileSync('/sys/bus/w1/devices/28-0000047c275a/w1_slave', { encoding: 'ascii' }); | |
var temperature; |
OlderNewer