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
<?php | |
include "json.php"; | |
use \Simple\json; | |
function cache_set($key, $val) { | |
$val = var_export($val, true); | |
$val = str_replace("stdClass::__set_state", "(object)", $val); | |
$tmp = "/tmp/$key." . uniqid("", true) . ".tmp"; | |
file_put_contents($tmp, "<?php $val = " . $val . ";", LOCK_EX); | |
rename($tmp, "/tmp/$key"); |
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
<?php | |
include 'json.php'; | |
function cache_get($key) { | |
@include "/tmp/$key"; | |
return isset($val) ? $val : false; | |
} | |
$response = new \Simple\json(); |
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
# See https://wiki.odroid.com/troubleshooting/gpiomem | |
sudo apt-get install i2c-tools python-smbus | |
sudo addgroup gpio | |
sudo usermod -a -G gpio odroid | |
# meson-gpiomem is for C1/C2 | |
# exynos-gpiomem is for XU4 | |
echo """SUBSYSTEM==\"exynos-gpiomem\", GROUP=\"gpio\", MODE=\"0660\" | |
SUBSYSTEM==\"meson-gpiomem\", GROUP=\"gpio\", MODE=\"0660\" |
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
sudo apt update | |
sudo apt install python-dev python-setuptools swig3.0 | |
git clone --recursive https://github.com/hardkernel/WiringPi2-Python.git | |
cd WiringPi2-Python | |
swig3.0 -python -threads wiringpi.i | |
sudo python setup.py build install | |
### PYTHON 3 |
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 python | |
# -*- coding: utf-8 -*- | |
""" | |
PCA9633.py | |
Author : Alexis PAQUES (@AlexisTM) | |
""" | |
import wiringpi2 as wpi | |
import time |
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 python | |
# -*- coding: utf-8 -*- | |
""" | |
PCA9633.py | |
Author : Alexis PAQUES (@AlexisTM) | |
""" | |
import rospy | |
import wiringpi2 as wpi | |
import time |
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
#include <stdio.h> | |
char *itohex(int n) { | |
int i = 2*sizeof (int); | |
char *str = malloc(i + 1); | |
str[i] = '\0'; | |
for ( ; i > 0; n >>= 4) | |
str[--i] = "0123456789ABCDEF"[n&0xF]; | |
return str; |
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
adhoc() { | |
if [ -z ${1+x} ]; | |
then echo -e "Run this using: \nadhoc on wlan0\nadhoc off"; | |
return 1 | |
else | |
ACTION=$1 | |
WIFI_INTERFACE=$2 | |
case $ACTION in |
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
// Normal throttle for a normal function call | |
function throttle(func, delay) { | |
let timeout; | |
return function(...args) { | |
if (!timeout) { | |
timeout = setTimeout(() => { | |
func.call(this, ...args) | |
timeout = null | |
}, delay) | |
} |
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 python2 | |
from __future__ import division | |
import os | |
import glob | |
import rospy | |
from pymavlink import mavutil | |
from threading import Thread | |
from mavros_msgs.msg import Mavlink, StatusText | |
from mavros import mavlink |
OlderNewer