通过fchdir和getcwd获取文件描述符对应的文件名
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
int main()
{
char cwdbuf[4096];
通过fchdir和getcwd获取文件描述符对应的文件名
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
int main()
{
char cwdbuf[4096];
# 有三个显示器
outs = ['e1', 'h1', 'e2']
# 需要得到的数组
[['e1'],
['h1'],
['e2'],
['e1', 'h1'],
['e1', 'e2'],
want_touch_pinch=1
want_debug=0
want_temp_profile=0
want_verbose=0
while [ $# -gt 0 ]; do
case "$1" in
-h | --help | -help )
usage
exit 0 ;;
test "$VERSION" || return 2
test "$FILE_NAME" || return 3
#! /usr/bin/env python3 | |
# change wallpaper every argv[2] seconds | |
# photo folder is argv[1] | |
# use "kill -s 10 `/tmp/autofeh.pid`" to change by yourself | |
import os | |
import sys | |
import time | |
import signal |
protected static TStruct BytesToStruct<TStruct>(byte[] bs, int bs_length) where TStruct : new() | |
{ | |
int typeLen = Marshal.SizeOf(typeof(TStruct)); | |
IntPtr tmp = Marshal.AllocHGlobal(typeLen); // 分配托管内存 | |
Marshal.Copy(bs, 0, tmp, bs_length); // 将字节复制到托管内存 | |
TStruct rv = (TStruct)Marshal.PtrToStructure(tmp, typeof(TStruct)); | |
Marshal.FreeHGlobal(tmp); // 释放托管内存 | |
return rv; | |
} |
#! /usr/bin/bash | |
kquitapp5 plasmashell && kstart5 plasmashell |
cat /dev/urandom | od -x | cut - -d ' ' -f 2- --output-delimiter '' |
tail -f server_output | ncat -l -p 8888 --keep-open | ncat localhost 8000 >> server_output
这行命令可以将来自8888端口的数据转发到localhost:8000
。
Update
mkfifo fifo
cat fifo | ncat -l -p 8888 | pv | ncat localhost 8000 > fifo
在crontab中直接使用notify-send不会起作用,因为在crontab执行的shell里,缺少一个$DBUS_SESSION_BUS_ADDRESS
变量,运行时设置以下这个变量就行了。
export DBUS_SESSION_BUS_ADDRESS='unix:path=/run/user/1000/bus'