Skip to content

Instantly share code, notes, and snippets.

<?php
/*
+----------------------------------------------------------------------+
| Xdebug |
+----------------------------------------------------------------------+
| Copyright (c) 2002-2018 Derick Rethans |
+----------------------------------------------------------------------+
| This source file is subject to version 1.01 of the Xdebug license, |
| that is bundled with this package in the file LICENSE, and is |
| available at through the world-wide-web at |
@userid
userid / tracefile-analyser.php
Created July 22, 2019 04:44
Xdebug and tracing memory usage
<?php
/*
+----------------------------------------------------------------------+
| Xdebug |
+----------------------------------------------------------------------+
| Copyright (c) 2002-2018 Derick Rethans |
+----------------------------------------------------------------------+
| This source file is subject to version 1.01 of the Xdebug license, |
| that is bundled with this package in the file LICENSE, and is |
| available at through the world-wide-web at |
##/usr/lib/systemd/system/stubby.service
[Unit]
Description=stubby DNS resolver
Wants=network-online.target
After=network-online.target
[Service]
User=stubby
DynamicUser=yes
CacheDirectory=stubby
@userid
userid / shntool.sh
Created July 6, 2019 18:15
用shntool根据cue 分割wav,ape,flac。
shntool split -t "%n. %t" -f CDImage.cue -i wav CDImage.wav -o flac
#!/usr/bin/env python3
#
# Dumb script to dump (some) of bcache status
# Copyright 2013 Darrick J. Wong. All rights reserved.
#
# This file is part of Bcache. Bcache is free software: you can
# redistribute it and/or modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
@userid
userid / netease.php
Created May 14, 2019 04:29
群晖DS Audio, 歌词搜索
<?php
// Must set to false when running on DS Station
const DEBUG = false;
// Set to TURE is Chinese translation is needed
const NEED_TRANSLATION = false;
/**
* Implements the functions required by Audio Station/DSAudio.
#include <sys/types.h>
#include <sys/socket.h>
#include <string.h>
#include <stdlib.h>
#include <netdb.h>
#include <stdio.h>
int main(void) {
struct addrinfo hints;
struct addrinfo *result, *rp;
/* Return the canonical absolute name of a given file.
Copyright (C) 1996-2012 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@userid
userid / netlink1.c
Last active August 15, 2025 09:18
使用rtnetlink监听和判断网卡的状态变化
/**
http://guochongxin.github.io/c/c/c++/linux/netlink/rj45/%E7%BC%96%E7%A8%8B%E8%AF%AD%E8%A8%80/%E7%BD%91%E5%8D%A1/2014/12/05/tong_guo_netlink_jian_ce_wang_xian_cha_ba
最近有个需求需要检测RJ45网卡的网线有没有接上而最近正在了解Netlink相关资料刚好也看下通过Netlink可以进行检测故在此做下粗略笔记
1.首先要创建一个Netlink Socket在用户层使用如下参数来调用socket()函数
fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
#!/usr/bin/env perl
#
use 5.010;
use strict;
use AnyEvent::Socket;
use AnyEvent::Handle;
use EV;
$| = 1;