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 <SoftwareSerial.h> | |
const int MD49_RX = 8; | |
const int MD49_TX = 9; | |
const int SABER_TX = 10; | |
const int SABER_UNUSED = 11; | |
const int CMD_MD49 = 0x01; | |
const int CMD_SABER = 0x02; | |
SoftwareSerial md49(MD49_RX, MD49_TX); |
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 <SoftwareSerial.h> | |
const int MD49_RX = 8; | |
const int MD49_TX = 9; | |
SoftwareSerial md49(MD49_RX, MD49_TX); | |
void setup() { | |
// put your setup code here, to run once: |
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
class left_pad: | |
def __init__(this,PadChar=' ',width=4): | |
this.PadChar=PadChar | |
this.width = width | |
def LeftPad(this,stringToPadWithChar): | |
charsToPad=this.width-len(stringToPadWithChar) | |
OutStr='' | |
if(charsToPad>0): | |
for i in range(0,charsToPad): | |
OutStr=OutStr+this.PadChar |
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 json | |
import os | |
import os.path | |
import platform | |
import requests | |
import shutil | |
import subprocess | |
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> | |
#include <unistd.h> | |
#include <string.h> | |
typedef int (*scfunc)(const char *, const char *); | |
struct SysCall { | |
char* name; | |
scfunc func; |
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
127.0.0.1: ===================================================== | |
127.0.0.1: IPMI 1.5 Get Channel Authentication Capabilities Request | |
127.0.0.1: ===================================================== | |
127.0.0.1: RMCP Header: | |
127.0.0.1: ------------ | |
127.0.0.1: [ 6h] = version[ 8b] | |
127.0.0.1: [ 0h] = reserved[ 8b] | |
127.0.0.1: [ FFh] = sequence_number[ 8b] | |
127.0.0.1: [ 7h] = message_class.class[ 5b] | |
127.0.0.1: [ 0h] = message_class.reserved[ 2b] |
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
# <hack> | |
# our D-Bus library is missing async :( | |
# source: https://github.com/LEW21/pydbus/issues/58 | |
def _async_result_handler(obj, result, user_data): | |
"""Generic callback dispatcher called from glib loop when an async method | |
call has returned. This callback is set up by method dbus_async_call.""" | |
(result_callback, error_callback, real_user_data) = user_data | |
try: | |
ret = obj.call_finish(result) |
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 contextlib | |
@contextlib.contextmanager | |
def lennyface(): | |
global print | |
oldprint = print | |
def new_print(*args, **kwargs): | |
#newargs = [a.replace(' ', '( ͡° ͜ʖ ͡°)') for a in args] | |
args = list(args) |
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
""" | |
Add copy to clipboard from IPython! | |
To install, just copy it to your profile/startup directory, typically: | |
~/.ipython/profile_default/startup/ | |
Example usage: | |
%clip hello world | |
# will store "hello world" | |
a = [1, 2, 3] | |
%clip a | |
# will store "[1, 2, 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
from __future__ import print_function | |
import random | |
board = ['wheat', 'wood', 'sheep'] * 4 + ['rock', 'brick'] * 3 + ['desert'] | |
random.shuffle(board) | |
slices = [ | |
board[0:3], | |
board[3:7], | |
board[7:12], |