Skip to content

Instantly share code, notes, and snippets.

View thinkhy's full-sized avatar
🐕
On vacation

thinkhy thinkhy

🐕
On vacation
View GitHub Profile
@g0t4
g0t4 / links.md
Last active May 10, 2021 08:14
Starting Point Files for Jenkins2 Getting Started course
@wsargent
wsargent / docker_cheat.md
Last active August 31, 2023 12:10
Docker cheat sheet
@thinkhy
thinkhy / ch7_exam.pl
Last active December 10, 2015 01:48
Exercise for Chapter 7 of "Intermediate Perl"
#########################################################################
# Brief: Exercise for Chapter 7 of "Intermediate Perl"
# File: ch7_exam.pl
# Creator: thinkhy
# Date: 12/23/2012
#########################################################################
use File::Find;
use Time::Local;
use File::Spec::Functions qw(canonpath no_upwards);
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active April 24, 2024 12:19
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@thinkhy
thinkhy / readnote_uss.txt
Created April 4, 2012 14:22
Reading note for UNIX System Services z/OS Version 1 Release Implementation
#+TITLE: Reading Note for UNIX System Services Implementation
#+AUTHOR: thinkhy
#+DATE: 05/06/2012 Sun
* ********************************************************
* gist: https://gist.github.com/gists/2301530
* Book: z/OS UNIX System Services Implementation
* [[www.redbooks.ibm.com/redbooks/pdfs/sg247035.pdf][Redbook]]
* ********************************************************
@aemkei
aemkei / LICENSE.txt
Last active April 12, 2024 21:27 — forked from 140bytes/LICENSE.txt
Binary Tetris - 140byt.es
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
/**********************************************************************************
* file: pursueLover.cpp
* brief: Simulation code for the paper: http://songshuhui.net/archives/57722.
* author: thinkhy
* last version: https://gist.github.com/1143934
* date: 2011-08-13
**********************************************************************************/
#include <cstdio>
#include <cstdlib>
using namespace std;
@thinkhy
thinkhy / xhtml2ooxml.pl
Created July 10, 2011 08:07
Convert XHTML to OOXML
#!/usr/bin/perl -w
#################################################################
# filename: xhtml2ooxml.pl
# brief: Convert xhtml to ooxml format for Founder WordEditor
# creator: thinkhy
# date: 11/06/23
# changelog:
#
#################################################################
use Cwd;
@thinkhy
thinkhy / tedSubtitle.pl
Last active October 6, 2017 14:59
Get subtitle for TED video
#!/usr/local/bin/perl
################################################################################
# File: tedSubtitle.pl
# Desscription: Get ted talk's subtitle from TED.com
# and convert subtitle of TED video to SRT format(SubRip Subtitle File)
# Usage: ted.pl URL languageCode output.src
# Creator: Thinkhy
# Date: 2011.04.30
# ChangeLog: 1 Add language code. [thinkhy 2011.05.06]
# 2 Read advertisement time from the parameter of introDuration in html.
@thinkhy
thinkhy / 关于Socket的recv与send原理
Created January 16, 2011 02:55
关于Socket的recv与send
http://topic.csdn.net/u/20080414/14/7e4737fe-53c5-443a-b38a-7735c423e4aa.html
对于send函数:
send函数只负责将数据提交给协议层。
当调用该函数时,send先比较待发送数据的长度len和套接字s的发送缓冲区的长度,如果len大于s的发送缓冲区的长度,该函数返回SOCKET_ERROR;
如果len小于或者等于s的发送缓冲区的长度,那么send先检查协议是否正在发送s的发送缓冲中的数据;
如果是就等待协议把数据发送完,如果协议还没有开始发送s的发送缓冲中的数据或者s的发送缓冲中没有数据,那么send就比较s的发送缓冲区的剩余空间和len;
如果len大于剩余空间大小,send就一直等待协议把s的发送缓冲中的数据发送完,如果len小于剩余空间大小,send就仅仅把buf中的数据copy到剩余空间里(注意并不是send把s的发送缓冲中的数据传到连接的另一端的,而是协议传的,send仅仅是把buf中的数据copy到s的发送缓冲区的剩余空间里)。
如果send函数copy数据成功,就返回实际copy的字节数,如果send在copy数据时出现错误,那么send就返回SOCKET_ERROR;