Skip to content

Instantly share code, notes, and snippets.

View lianyi's full-sized avatar

lianyi lianyi

View GitHub Profile
@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)
@khanhnamle1994
khanhnamle1994 / main.py
Last active January 26, 2024 22:14
FCN - Full Code
#--------------------------
# USER-SPECIFIED DATA
#--------------------------
# Tune these parameters
num_classes = 2
image_shape = (160, 576)
EPOCHS = 40
BATCH_SIZE = 16
@lianyi
lianyi / test.sh
Created June 12, 2017 19:02
solr testing Transfer-Encoding: chunked
export SOLRUPDATE='http://localhost:8983/solr/testingCore/update?wt=json&commit=true'
export SOLRQUERY='http://localhost:8983/solr/testingCore/select?wt=json&q=*:*'
curl $SOLRUPDATE --data-binary '[{"id": "1"},{"id": "2"}]' -H 'Content-Type: application/json' -X POST -H "Transfer-Encoding: chunked"
#>> response {"responseHeader":{"status":0,"QTime":295}}
curl $SOLRQUERY
#>> {"responseHeader":{"status":0,"QTime":15,"params":{"q":"*:*","wt":"json"}},"response":{"numFound":2,"start":0,"maxScore":1.0,"docs":[{"id":"1","_version_":1570026155898044416},{"id":"2","_version_":1570026155878121472}]}}
@fchollet
fchollet / classifier_from_little_data_script_3.py
Last active July 23, 2024 16:32
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

Simplest way to add pan/zoom to a d3js visualisation

@lianyi
lianyi / geo_usstates.js
Last active April 11, 2016 18:32 — forked from mshafrir/states_hash.json
US states in JSON and JS format
var geo_usstates = {
"type": "FeatureCollection",
"features": [{
"type": "Feature",
"id": "01",
"properties": {
"name": "AL"
},
"geometry": {
@baraldilorenzo
baraldilorenzo / readme.md
Last active October 10, 2024 23:19
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 / Jetty IP restriction.md
Last active August 29, 2015 14:27
Jetty(SOLR) Configuration for IP restrictions

Usage

java -jar start.jar etc/jetty.xml etc/iprestriction.xml

Notes

The idea is to use mixin to isolate ip configurations without touching the main configuration file.

#Versions tested:

@smithkyle
smithkyle / Install passport-ldapauth
Created May 8, 2015 18:21
MEAN.js passport-ldapauth integration
npm install -S passport-ldapauth