Skip to content

Instantly share code, notes, and snippets.

@lorinma
lorinma / c9.sh
Created December 27, 2015 19:33
running ipython notebook on cloud9
ipython notebook --ip=0.0.0.0 --port=8080 --no-browser
RUN wget -O miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh; bash miniconda.sh -b -p $HOME/miniconda;
ENV PATH $HOME/miniconda/bin:$PATH
RUN rm -rf miniconda.sh
# -*- coding: utf-8 -*-
# transformations.py
# Copyright (c) 2006-2015, Christoph Gohlke
# Copyright (c) 2006-2015, The Regents of the University of California
# Produced at the Laboratory for Fluorescence Dynamics
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@lorinma
lorinma / ConcaveHull.py
Created December 6, 2015 17:32
using scipy and networkx
from scipy.spatial import Delaunay,ConvexHull
import networkx as nx
points = [ [0,0],[0,50],[50,50],[50,0],[0,400],[0,450],[50,400],[50,450],[700,300],[700,350],[750,300],[750,350],
[900,600],[950,650],[950,600],[900,650]
]
def concave(points,alpha_x=150,alpha_y=250):
points = [(i[0],i[1]) if type(i) <> tuple else i for i in points]
de = Delaunay(points)
dec = []
@lorinma
lorinma / pts2pcd
Created December 5, 2015 08:19
convert pts file to pcd file
filename="DamagedBeam.pts"
from numpy import loadtxt
from numpy import savetxt
lines = loadtxt(filename,skiprows=1)
size=str(lines[:,0].size)
header = "VERSION .7\nFIELDS x y z\nSIZE 4 4 4\nTYPE F F F\nCOUNT 1 1 1\nWIDTH "+size+"\nHEIGHT 1\nVIEWPOINT 0 0 0 1 0 0 0\nPOINTS "+size+"\nDATA ascii"
pcd=lines[:,[0,1,2]]
savetxt("DamagedBeam.pcd", pcd, fmt="%f",header=header,comments='')
@lorinma
lorinma / ShuffleLetter.py
Created November 30, 2015 07:29
Shuffle the letters in a sentence
s="HuazhongUniversityofScienceandTechnologyrankedtop19globaluniversityforengineeringin2015"
l=list(s)
x = [i for i in l]
from random import shuffle
shuffle(x)
x
"".join(x)
@lorinma
lorinma / homebrew-github-api-token.md
Last active August 29, 2015 14:25 — forked from christopheranderton/homebrew-github-api-token.md
Set your Github API Token If you hit a ”GitHub API rate limit exceeded” when searching with Homebrew (http://brew.sh/).

Description

When using Homebrew (http://brew.sh) and searching formulas or pull requests you may get the dreaded error message: Github API Rate limit exceeded

Let's fix that! (yeah!)


Short version

Create a new Personal Token in your Github Account Settings (Sidebar: Applications) and then copy the Token. In the Terminal, use export HOMEBREW_GITHUB_API_TOKEN=YOURAPITOKENWITHFUNKYNUMBERSHERE (change that to your API Token) or add that to your .bash_profile and then do source .bash_profile.

#!/usr/bin/env python2
'''Serving dynamic images with Pandas and matplotlib (using flask).'''
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from cStringIO import StringIO

cat

For pupil: all binary can be downloaded http://pan.baidu.com/s/1hqH2Pko

For programmer:

VERSION PLATFORM OFFSET ORIGINAL CRACKED
3086 Linux x64 0xd763 85 39
3086 Linux x86 0xd192 85 39

MacOS

Build 3059

MD5: 59bab8f71f8c096cd3f72cd73851515d

Rename it to: Sublime Text

Make it executable with: chmod u+x Sublime\ Text