Skip to content

Instantly share code, notes, and snippets.

View zhouhao's full-sized avatar
🗯️

SaltyEgg zhouhao

🗯️
View GitHub Profile
@zhouhao
zhouhao / tmux_commands.md
Created April 24, 2018 18:15 — forked from Alek-S/tmux_commands.md
tmux Commands

Start new named session:

tmux new -s [session name]

Detach from session:

ctrl+b d

List sessions:

tmux ls

Attach to named session:

@zhouhao
zhouhao / Max Points on a Line [LeetCode]
Created March 18, 2014 06:26
Max Points on a Line [LeetCode]
/**
* Given n points on a 2D plane, find the maximum number of points that lie on the same straight line.
*/
import java.util.Map;
import java.util.HashMap;
import java.util.Set;
public class MaxPointsOnALine {
public static int maxPoints(Point[] points) {
if(points.length < 2) return points.length;
int pointCount = points.length;
@zhouhao
zhouhao / Get IP by Hostname
Last active December 13, 2015 23:09
Get IP by Hostname [Using C]
#include<stdio.h>
#include<stdlib.h>
#include<netdb.h>
#include<arpa/inet.h>
int main(int argc, char **argv) {
struct hostent *host;
char str[100];
char addr[INET_ADDRSTRLEN];