Skip to content

Instantly share code, notes, and snippets.

View amaork's full-sized avatar
🏠
Working from home

Amaork amaork

🏠
Working from home
View GitHub Profile
@amaork
amaork / fast_scan_lan_port.py
Last active December 1, 2017 03:57
Thread pool fast scan lan specify port host
import time
import socket
import websocket
import concurrent.futures
def get_host_address():
try:
for addr in socket.gethostbyname_ex(socket.gethostname())[2]:
@amaork
amaork / raspbian-python3.5.rst
Last active October 12, 2017 03:02 — forked from BMeu/raspbian-python3.5.rst
Installing Python 3.5 on Raspbian

Installing Python 3.5 on Raspbian

As of October 2016, Raspbian does not yet include the latest Python release, Python 3.5. This means we will have to build it ourselves, and here is how to do it.

  1. Install the required build-tools (some might already be installed on your system).

@amaork
amaork / raspi_restore_spi_alt_function.c
Created July 27, 2017 03:09
Raspberry pi restore spi alt0 function
#include <stdio.h>
#include <bcm2835.h>
int main(int argc, char **argv)
{
if (!bcm2835_init()) {
fprintf(stderr, "bcm2835_init failed!\n");
return -1;
}
@amaork
amaork / raspi_gpio_spi_write.py
Created July 27, 2017 03:03
Raspberry pi using gpio simulate spi write
from __future__ import print_function
from raspi_io import GPIO
__all__ = ['GPIOSPI']
class GPIOSPI(object):
"""
SPI Frame | reg, reg | data 0 - 7|
"""
# Frame 10 bits
@amaork
amaork / raspi_write_winbond_w25q80_spi_flash.py
Created July 27, 2017 02:55
Raspberry pi read/write winbond W25Q80 SPI Flash
import sys
from spidev import SpiDev
class SPIFlash(object):
READ_ID = 0x9f
READ_RS = 0x05
CHIP_ERASE = 0x60
PAGE_READ = 0x3