Skip to content

Instantly share code, notes, and snippets.

View hans00's full-sized avatar
🤔
Thinking

Hans hans00

🤔
Thinking
View GitHub Profile
@hans00
hans00 / receive.py
Last active November 16, 2016 05:37
Simple sound ASK 100% modem in Python
from matplotlib.mlab import find
import pyaudio
import numpy as np
import math
chunk = 1024
FORMAT = pyaudio.paInt16
CHANNELS = 1
RATE = 44100
@hans00
hans00 / x86_64-asustor-linux-gnu.sh
Last active September 25, 2016 18:45
Cross Compile Script
#!/bin/sh
# config
TOOL_PATH=/opt/tools/x86_64-asustor-linux-gnu
TARGET_PLATFORM=x86_64-asustor-linux-gnu
TARGET_PATH=/opt/target
# check you in shell self
case $0 in
-bash) ;;
@hans00
hans00 / show_message.py
Last active September 23, 2016 04:31
Shell full screen welcome message
#!/usr/bin/env python
from time import sleep
import os, sys
# Env
rows, cols = os.popen('stty size', 'r').read().split()
filename = os.path.expanduser("~/.welcome_msg")
rows = int(rows)
cols = int(cols)
@hans00
hans00 / random_list.py
Last active November 30, 2016 08:32
Random.ORG - random list in python
#!/usr/bin/env python
import randomdotorg, sys, os
try:
count = int(sys.argv[len(sys.argv)-1])
sys.argv = sys.argv[:len(sys.argv)-1]
except ValueError:
count = 1
if len(sys.argv) == 1:
print "You must input file path or list and pick count."
#define pingTO 1500 // ping Time Out
float ping(int out, int in) { // in = Echo , out = Trig
digitalWrite(out, LOW);
delayMicroseconds(2);
digitalWrite(out, HIGH);
delayMicroseconds(10);
digitalWrite(out, LOW);
float duration = pulseIn(in, HIGH, pingTO);
if ( !duration ) duration = pingTO;