Skip to content

Instantly share code, notes, and snippets.

@shawnfeng0
shawnfeng0 / current_utc_time.c
Created April 27, 2023 18:20 — forked from jbenet/current_utc_time.c
work around lack of clock_gettime in os x
/*
author: jbenet
os x, compile with: gcc -o testo test.c
linux, compile with: gcc -o testo test.c -lrt
*/
#include <time.h>
#include <sys/time.h>
#include <stdio.h>
@shawnfeng0
shawnfeng0 / sockaddr_tostr.h
Created December 23, 2020 04:56 — forked from jkomyno/sockaddr_tostr.h
Convert a struct sockaddr address to a string, IPv4 and IPv6
// Convert a struct sockaddr address to a string, IPv4 and IPv6:
char *get_ip_str(const struct sockaddr *sa, char *s, size_t maxlen)
{
switch(sa->sa_family) {
case AF_INET:
inet_ntop(AF_INET, &(((struct sockaddr_in *)sa)->sin_addr),
s, maxlen);
break;
@shawnfeng0
shawnfeng0 / CMakeLists.txt
Created November 30, 2018 16:47 — forked from khancyr/CMakeLists.txt
Ardupilot clion
cmake_minimum_required(VERSION 2.8.4)
project(Ardupilot)
# Function: EXCLUDE_FILES_FROM_DIR_IN_LIST
# Description: Exclude all files from a list under a specific directory.
# Param _InFileList: Input and returned List
# Param _excludeDirName: Name of the directory, which shall be ignored.
# Param _verbose: Print the names of the files handled
FUNCTION (EXCLUDE_FILES_FROM_DIR_IN_LIST _InFileList _excludeDirName _verbose)
@shawnfeng0
shawnfeng0 / docker-cross-device-link.md
Created November 28, 2018 12:53 — forked from Francesco149/docker-cross-device-link.md
docker error creating new backup file '/var/lib/dpkg/status-old': Invalid cross-device link
@shawnfeng0
shawnfeng0 / tmux-cheatsheet.markdown
Created October 11, 2018 05:33 — forked from ryerh/tmux-cheatsheet.markdown
Tmux 快捷键 & 速查表

注意:本文内容适用于 Tmux 2.3 及以上的版本,但是绝大部分的特性低版本也都适用,鼠标支持、VI 模式、插件管理在低版本可能会与本文不兼容。

Tmux 快捷键 & 速查表

启动新会话:

tmux [new -s 会话名 -n 窗口名]

恢复会话:

@shawnfeng0
shawnfeng0 / tmux-cheatsheet.markdown
Created October 11, 2018 04:23 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname