Skip to content

Instantly share code, notes, and snippets.

View lianyi's full-sized avatar

lianyi lianyi

View GitHub Profile
@lianyi
lianyi / chat-frontend.js
Created June 15, 2019 21:39 — forked from martinsik/chat-frontend.js
Node.js chat frontend and server
$(function () {
"use strict";
// for better performance - to avoid searching in DOM
var content = $('#content');
var input = $('#input');
var status = $('#status');
// my color assigned by the server
var myColor = false;
@lianyi
lianyi / vtk2vtp.py
Created March 4, 2019 17:14 — forked from thomasballinger/vtk2vtp.py
vtk2vtp.py
#!/usr/bin/env python
"""File format conversion
category: vtk, file conversion, tomb"""
import os, sys
import vtk
def vtk2vtp(invtkfile, outvtpfile, binary=False):
"""What it says on the label"""
reader = vtk.vtkPolyDataReader()
@lianyi
lianyi / analog.py
Created February 28, 2019 01:40
The following code can be downloaded directly to your Raspberry Pi. It will read the trimpot value, translate the reading to a volume range and modify the OS output volume level on your Raspberry Pi. The remap_range() method is being used to convert the 16-bit analog in range 0 - 65,535 to volume 0-100%.
import os
import time
import busio
import digitalio
import board
import adafruit_mcp3xxx.mcp3008 as MCP
from adafruit_mcp3xxx.analog_in import AnalogIn
# create the spi bus
spi = busio.SPI(clock=board.SCK, MISO=board.MISO, MOSI=board.MOSI)
@lianyi
lianyi / README-opencv-3.1-raspberry-pi-installation.md
Created February 3, 2019 14:32 — forked from willprice/README-opencv-3.1-raspberry-pi-installation.md
How to install OpenCV 3.1 on Raspbian Jessie (Lite)

Installing OpenCV 3.1 on Raspbian Jessie

Prerequisites

  • Keep your system up to date:
    • $ sudo apt-get update
    • $ sudo apt-get upgrade
    • $ sudo reboot
  • Make sure you've got an internet connection.
  • Make sure you've got
  • wget
@lianyi
lianyi / Raspberry Pi Setup.md
Created February 2, 2019 20:31
Raspberry Pi Setup
layout title permalink
default
Raspberry Pi Setup
/tutorials/Raspberry-Pi-setup/

Raspberry Pi Setup

by Chris Lovett and Ofer Dekel

@lianyi
lianyi / mongo_import.js
Created September 12, 2018 21:36 — forked from RandomEtc/mongo_import.js
use node.js to copy from one mongo db to another
var url = require('url'),
mongodb = require('mongodb');
var sourceUrl = 'mongodb://user:pass@host:port/db',
targetUrl = 'mongodb://user:pass@host:port/db',
collectionName = 'my_awesome_collection';
function openDbFromUrl(mongoUrl, cb) {
var dbUrl = url.parse(mongoUrl),
dbName = dbUrl.pathname.slice(1), // no slash
#create a test index with shingle mapping
curl -XPUT localhost:9200/test -d '{
"settings":{
"index":{
"analysis":{
"analyzer":{
"analyzer_shingle":{
"tokenizer":"standard",
"filter":["standard", "lowercase", "filter_stop", "filter_shingle"]
}
@lianyi
lianyi / main.py
Last active February 20, 2022 20:17 — forked from khanhnamle1994/main.py
FCN - Full Code
# --------------------------
# Source and reference
# https://github.com/udacity/CarND-Semantic-Segmentation
# https://gist.github.com/lianyi/a5ba8d84f5b68401c2313b05e020b062
# https://medium.com/nanonets/how-to-do-image-segmentation-using-deep-learning-c673cc5862ef
# --------------------------
# --------------------------
# DATA PREPARATION
@lianyi
lianyi / readme.md
Created January 10, 2018 17:30 — forked from baraldilorenzo/readme.md
VGG-16 pre-trained model for Keras

##VGG16 model for Keras

This is the Keras model of the 16-layer network used by the VGG team in the ILSVRC-2014 competition.

It has been obtained by directly converting the Caffe model provived by the authors.

Details about the network architecture can be found in the following arXiv paper:

Very Deep Convolutional Networks for Large-Scale Image Recognition

K. Simonyan, A. Zisserman

@lianyi
lianyi / classifier_from_little_data_script_3.py
Created January 10, 2018 17:27 — forked from fchollet/classifier_from_little_data_script_3.py
Fine-tuning a Keras model. Updated to the Keras 2.0 API.
'''This script goes along the blog post
"Building powerful image classification models using very little data"
from blog.keras.io.
It uses data that can be downloaded at:
https://www.kaggle.com/c/dogs-vs-cats/data
In our setup, we:
- created a data/ folder
- created train/ and validation/ subfolders inside data/
- created cats/ and dogs/ subfolders inside train/ and validation/
- put the cat pictures index 0-999 in data/train/cats