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
/* | |
Copyright (c) 2018, 2019 Roy van Dam <[email protected]> | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is | |
furnished to do so, subject to the following conditions: |
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 <iostream> | |
#include <fstream> | |
#include <vector> | |
#include <istream> | |
#include <chrono> | |
#include <thread> | |
class Tail { | |
public: |
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(${CMAKE_ROOT}/Modules/ExternalProject.cmake) | |
ExternalProject_Add(googletest | |
GIT_REPOSITORY "https://github.com/google/googletest.git" | |
GIT_TAG "master" | |
UPDATE_COMMAND "" | |
INSTALL_COMMAND "") | |
SET(GTEST_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/googletest-prefix/src/googletest/googletest/include) | |
SET(GTEST_LIB_DIR ${CMAKE_CURRENT_BINARY_DIR}/googletest-prefix/src/googletest-build/googlemock/gtest) |
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 tempfile, os, shutil | |
import socket, errno | |
import subprocess | |
import platform | |
class dotdict(dict): | |
__getattr__ = dict.get | |
__setattr__ = dict.__setitem__ | |
__delattr__ = dict.__delitem__ |
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 subprocess | |
class RemoteShell: | |
def __init__(self, hostname, port=514, username='root', encoding='ascii'): | |
self.hostname = hostname | |
self.port = port | |
self.username = username | |
self.encoding = encoding | |
self.rsh = ['/usr/bin/rsh', '-p', str(port), '%s@%s' % (username, hostname) ] |
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 socket | |
import struct | |
class eth8020: | |
def __init__(self, hostname, port=17494): | |
self.s = socket.create_connection((hostname, int(port))) | |
def execute(self, request): | |
self.s.send(request) | |
response = self.s.recv(10) |
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 | |
# Call from your SVN directory the following way: | |
# svn status | grep '?' | tr -s ' ' | cut -d' ' -f2 | xargs -n1 ./svn_ignore.py | |
import sys, os, subprocess | |
def svn(action, argv=[], stdin=None): | |
cmd = ['svn', action] | |
cmd.extend(argv) |
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
svn() { | |
local svn_cmd='/usr/bin/env svn' | |
case $1 in | |
stash) | |
case $2 in | |
"") | |
if ! $svn_cmd status | grep -q '^M'; then | |
echo "No outstanding changes" | |
return | |
fi |
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 | |
import signal, time, threading, socket, sys | |
import Adafruit_BBIO.GPIO as GPIO | |
class Pir: | |
def __init__(self, pin, pud=GPIO.PUD_UP): | |
self.pin = pin | |
self.pud = pud | |
GPIO.setup(self.pin, GPIO.IN, pull_up_down=pud) |
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 | |
import sys | |
import socket | |
import select | |
def usage(name): | |
print('Usage {} [hostname:port](2..n)'.format(name)) | |
if (len(sys.argv) < 3): |