Skip to content

Instantly share code, notes, and snippets.

View squirrel532's full-sized avatar

Squirrel squirrel532

View GitHub Profile
2015-09-23 14:11:18 +0800
../configure
--build=x86_64-apple-darwin14.5.0
--prefix=/usr/local/Cellar/gcc/5.2.0
--libdir=/usr/local/Cellar/gcc/5.2.0/lib/gcc/5
--enable-languages=c,c++,objc,obj-c++,fortran
--program-suffix=-5
--with-gmp=/usr/local/opt/gmp
--with-mpfr=/usr/local/opt/mpfr

B10315002 四資工二 黃昱豪

計算機網路概論 作業二

R24

  • 需要經由傳輸層傳輸的資料
  • 由傳輸層生成的資料,包括應用層的資料以及傳輸層的標頭
  • 使用網路層的標頭封裝傳輸層的資料
  • 經由連結層封裝的資料

##Python 3.5

  • ASYNC, AWAIT
  • single thread
  • event loop
  • taskqueue celery == asyncio

Type Hit

  • It's just a hint, a comment, let your code be self-documenting.
@squirrel532
squirrel532 / ptt.sh
Last active February 29, 2016 08:52
#!/bin/bash
# tty_pipe=$(tty)
# echo "\$tty_pipe = $tty_pipe"
[ -z "$USER" ] && echo -ne "User: " && read USER
[ -z "$PASS" ] && echo -ne "Password: " && read -s PASS
function autoptt()
{
for i in range(1001):
for j in range(i, 1001):
for k in range(1001):
tmp1 = i ** 2 + j ** 2
tmp2 = k ** 2
if tmp1 == tmp2:
print(i, j, k)
elif tmp2 > tmp1:
break
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include <time.h>
#include <assert.h>
inline void swap_char(char *a, char *b) {
*a ^= *b; *b ^= *a; *a ^= *b;
}
#include <stdio.h>
/*
This function, rec will prints all number between va and vb
in diminishing order.
rec(1, 5) and rec(5, 1) give same output.
*/
int rec(int va, int vb) {
(va > vb) && printf("%d\n", va);
(vb >= va) && printf("%d\n", vb);
return va != vb && rec(va - (va>vb), vb - (vb > va));
#!/bin/bash
device=$1
cmd=$2
username="username_on_device"
IDENTITY_FILE="/path/to/key"
case $cmd in
"shutdown") ssh $username@localhost -i $IDENTITY_FILE -p $device -At sudo shutdown -h now ;;
@squirrel532
squirrel532 / General Makefile
Created May 22, 2017 15:57 — forked from reecer/General Makefile
A general makefile for general-purpose C projects.
CC=gcc
CCFLAGS=-Wall
LDFLAGS=
SOURCES=$(wildcard *.c)
OBJECTS=$(SOURCES:.c=.o)
TARGET=des
all: $(TARGET)
$(TARGET): $(OBJECTS)
@squirrel532
squirrel532 / git-filter-branch-move-files.md
Created July 24, 2018 17:03 — forked from fabiomaggio/git-filter-branch-move-files.md
Use git filter-branch to move all projects files to a subdir and rewrite all commits
  1. Clone project

  2. Checkout all branches that contain the files that should be moved

  3. Delete the remote

  4. Run the filter-branch command:

    git filter-branch --tree-filter 'mkdir -p /path/to/tmp; mv * /path/to/tmp; mkdir subdir; mv /path/to/tmp/* subdir/' --tag-name-filter cat --prune-empty -- --all
    • All files are first copied to a temporary dir and move from there to the new destination
  • Existing tags are updated