Skip to content

Instantly share code, notes, and snippets.

View jim0409's full-sized avatar
🚩
Focusing

Jim Weng jim0409

🚩
Focusing
View GitHub Profile
@jim0409
jim0409 / gist:5d6e2cb07b4a0e7295e00b1ea16213bd
Created October 10, 2017 15:48 — forked from brianhsu/gist:769132
[Scala] 猜數字網路連線版 (Server)
import scala.actors.Actor
import scala.actors.Actor._
import scala.actors.remote.RemoteActor
import scala.actors.OutputChannel
import scala.util.Random
case class Status(x: String, a: Int, b: Int)
case class Guess(gameID: Int, x: String)
case class GameID(gameID: Int)
@jim0409
jim0409 / curl.sh
Created December 5, 2017 01:31 — forked from FylmTM/curl.sh
Neo4j curl call example
#!/bin/bash
QUERY=query.json
time curl -i -XPOST \
-o output.log \
--data "@$QUERY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
http://127.0.0.1:7474/db/data/transaction/commit
@jim0409
jim0409 / example.hmm
Created March 23, 2018 12:47 — forked from djsutherland/example.hmm
Code for a Hidden Markov Model, along with some sample data / parameters for testing.
4 # number of states
START
COLD
HOT
END
3 # size of vocab
1
2
3

Python Socket 编程详细介绍

Python 提供了两个基本的 socket 模块:

  • Socket 它提供了标准的BSD Socket API。
  • SocketServer 它提供了服务器重心,可以简化网络服务器的开发。

下面讲解下 Socket模块功能。

Socket 类型

@jim0409
jim0409 / jupyter_shortcuts.md
Created April 4, 2018 12:58 — forked from kidpixo/jupyter_shortcuts.md
Keyboard shortcuts for ipython notebook 3.1.0 / jupyter

Toc

Keyboard shortcuts

The IPython Notebook has two different keyboard input modes. Edit mode allows you to type code/text into a cell and is indicated by a green cell border. Command mode binds the keyboard to notebook level actions and is indicated by a grey cell border.

MacOS modifier keys:

  • ⌘ : Command
@jim0409
jim0409 / install virtualenv ubuntu 16.04.md
Created June 5, 2018 15:39 — forked from Geoyi/install virtualenv ubuntu 16.04.md
How to install virtual environment on ubuntu 16.04

How to install virtualenv:

Install pip first

sudo apt-get install python3-pip

Then install virtualenv using pip3

sudo pip3 install virtualenv 
@jim0409
jim0409 / curl.md
Created July 6, 2018 07:13 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@jim0409
jim0409 / gist:d52842a7918285aab52e099ba14bdec4
Created August 1, 2018 08:26 — forked from evildmp/gist:3094281
Set up Django, nginx and uwsgi

This document has now been incorporated into the uWSGI documentation:

http://uwsgi-docs.readthedocs.org/en/latest/tutorials/Django_and_nginx.html

Set up Django, nginx and uwsgi

Steps with explanations to set up a server using:

@jim0409
jim0409 / kubectl.md
Created August 7, 2018 03:48 — forked from so0k/kubectl.md
Playing with kubectl output

Kubectl output options

Let's look at some basic kubectl output options.

Our intention is to list nodes (with their AWS InstanceId) and Pods (sorted by node).

We can start with:

kubectl get no
@jim0409
jim0409 / install-go.sh
Created August 31, 2018 01:45 — forked from ndaidong/install-go.sh
Install Go 1.10 in Ubuntu 16+
#!/bin/bash
export GO_VERSION=1.10
export GO_DOWNLOAD_URL=https://storage.googleapis.com/golang/go$GO_VERSION.linux-amd64.tar.gz
export GOPATH=/usr/local/lib/go
export GOROOT=/usr/local/go
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
sudo mkdir ${GOPATH}
sudo chown ${USER} -R ${GOPATH}