Skip to content

Instantly share code, notes, and snippets.

View trevery's full-sized avatar

火山 trevery

View GitHub Profile
@trevery
trevery / README.md
Created October 24, 2022 09:47 — forked from maboloshi/README.md
[Mac下配置Aria2] #macOS #aria2

Mac下配置Aria2

安装和设置 Aria2

# 使用 Homebrew 安装 aria2
brew install aria2

# 创建配置文件aria2.conf和空对话文件aria2.session
mkdir ~/.aria2 && cd ~/.aria2
touch aria2.conf
@trevery
trevery / hadoop_spark_osx
Last active September 9, 2020 07:38 — forked from cjzamora/hadoop_spark_osx
Hadoop + Spark installation (OSX)
Source: http://datahugger.org/datascience/setting-up-hadoop-v2-with-spark-v1-on-osx-using-homebrew/
This post builds on the previous setup Hadoop (v1) guide, to explain how to setup a single node Hadoop (v2) cluster with Spark (v1) on OSX (10.9.5).
Apache Hadoop is a framework that allows for the distributed processing of large data sets across clusters of computers using simple programming models. It is designed to scale up from single servers to thousands of machines, each offering local computation and storage. Rather than rely on hardware to deliver high-availability, the library itself is designed to detect and handle failures at the application layer, so delivering a highly-available service on top of a cluster of computers, each of which may be prone to failures. The Apache Hadoop framework is composed of the following core modules:
HDFS (Distributed File System): a distributed file-system that stores data on commodity machines, providing very high aggregate bandwidth across the cluster.
YARN (Yet A
@trevery
trevery / fixpio.sh
Created March 26, 2019 09:08
fix problem when installing platformio on raspberry pi
#!/bin/sh
## install python if it isn't already installed, e.g. ##
#sudo apt-get install python
# remove problematic dist versions of pip and pyserial
sudo apt-get remove python-pip -y
sudo apt-get remove python-pyserial -y
# optional - python-serial includes other dependencies that can be cleaned up
sudo apt-get autoremove
@trevery
trevery / raspbian-1804-backup.sh
Created June 4, 2018 02:58
backup raspbian( stretch 2018.04.18 ) to a small img
#!/bin/sh
sudo apt-get install -y dosfstools parted kpartx rsync
df=`df -P | grep /dev/root | awk '{print $3}'`
dr=`df -P | grep /dev/mmcblk0p1 | awk '{print $2}'`
df=`echo $df $dr |awk '{print int(($1+$2)*1.2)}'`
sudo dd if=/dev/zero of=raspberrypi.img bs=1K count=$df
sudo parted raspberrypi.img --script -- mklabel msdos
start=`sudo fdisk -l /dev/mmcblk0| awk 'NR==10 {print $2}'`
start=`echo $start's'`
end=`sudo fdisk -l /dev/mmcblk0| awk 'NR==10 {print $3}'`
@trevery
trevery / miniconda_on_rpi.md
Created June 2, 2018 06:57 — forked from simoncos/miniconda_on_rpi.md
Install Miniconda 3 on Raspberry Pi
@trevery
trevery / flip.pde
Created May 20, 2018 16:09 — forked from shiffman/flip.pde
Flipping Video in Processing
import processing.video.*;
Capture cam;
void setup() {
size(640, 480);
cam = new Capture(this, 640, 480);
cam.start();
}
@trevery
trevery / edges.py
Created May 22, 2017 02:05 — forked from sight-machine/edges.py
A simple Canny edge detector demo using SimpleCV.
# Make a function that does a half and half image.
def halfsies(left,right):
result = left
# crop the right image to be just the right side.
crop = right.crop(right.width/2.0,0,right.width/2.0,right.height)
# now paste the crop on the left image.
result = result.blit(crop,(left.width/2,0))
# return the results.
return result
# Load an image from imgur.
@trevery
trevery / binarize.py
Created May 22, 2017 01:26 — forked from sight-machine/binarize.py
Image threshold with a side-by-side view using SimpleCV.
from SimpleCV import Image, Color, Display
# Make a function that does a half and half image.
def halfsies(left,right):
result = left
# crop the right image to be just the right side.
crop = right.crop(right.width/2.0,0,right.width/2.0,right.height)
# now paste the crop on the left image.
result = result.blit(crop,(left.width/2,0))
# return the results.
@trevery
trevery / scrap_whole_site_urls.py
Last active May 19, 2017 02:14
python 使用BeautifulSoup 采集整个页面的 URL
from urllib.request
import urlopen
from bs4
import BeautifulSoup
import re
pages = set()
def getLinks(pageUrl):
global pages
html = urlopen("http://en.wikipedia.org"+pageUrl)
@trevery
trevery / arduino_i2c_slave_read.ino
Created May 15, 2017 12:11
arduino i2c slave_read and do something in loop()
// Include the required Wire library for I2C<br>#include <Wire.h>
int LED = 13;
int x = 0;
void setup() {
// Define the LED pin as Output
pinMode (LED, OUTPUT);
// Start the I2C Bus as Slave on address 9
Wire.begin(9);
// Attach a function to trigger when something is received.
Wire.onReceive(receiveEvent);