Skip to content

Instantly share code, notes, and snippets.

@FutureBody
FutureBody / exec_notify.py
Created April 19, 2022 11:30 — forked from drdaeman/exec_notify.py
Listening to Netlink process events on x86_64 Linux systems (kludgy)
#!/usr/bin/env python
import socket
import os
import struct
if getattr(socket, "NETLINK_CONNECTOR", None) is None:
socket.NETLINK_CONNECTOR = 11
CN_IDX_PROC = 1
@FutureBody
FutureBody / commands.sh
Created April 8, 2022 08:22 — forked from shouya/commands.sh
gfw dns solution
#!/bin/sh
# this script is only written for gentoo
# if you're using other distro, modify part of it as needed
#
# please run this script run once, as su
sh dns.sh
iptables-save > /etc/iptables-local
cat > /etc/local.d/iptables-restore <<<EOF
#!/bin/sh
@FutureBody
FutureBody / ipv6startupfix
Created August 5, 2021 09:21 — forked from peterwillcn/ipv6startupfix
AFWall+ (and any other iptables firewall IPv6v6 fix at startup)
# This is an startup script example, how IPv6 should
# looks like, if not you will get some seriously
# problems.
# Some options may not work on your OS.
# ICMPv6 Stastics (optional)
# icmpv6_stats
# Optional may not work on all systems
ipset flush dns6
@FutureBody
FutureBody / ACM学习计划
Created July 10, 2020 06:27 — forked from dodola/ACM学习计划
ACM学习计划
ACM大量习题题库
ACM大量习题题库
现在网上有许多题库,大多是可以在线评测,所以叫做Online Judge。除了USACO是为IOI准备外,其余几乎全部是大学的ACM竞赛题库。
USACO
http://ace.delos.com/usacogate
美国著名在线题库,专门为信息学竞赛选手准备
@FutureBody
FutureBody / nginx-tuning.md
Created June 5, 2020 07:21 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@FutureBody
FutureBody / gen_Corefile.sh
Created March 24, 2020 03:09 — forked from rampageX/gen_Corefile.sh
generate Corefile which uses your ISP's DNS servers to resolve domain names in China and uses OpenDNS/Cloudflare/Google DNS servers to resolve domain names outside China for CoreDNS. You should change 116.228.111.118 180.168.255.18 to your ISP's DNS server address or use public DNS server such as 114/DNSPod etc. directly.
#!/bin/bash
echo ". {" > Corefile
echo " forward . 208.67.222.222:443 208.67.222.222:5353 208.67.220.220:443 208.67.220.220:5353 127.0.0.1:5301 127.0.0.1:5302 127.0.0.1:5303 {" >> Corefile
china=`curl https://cdn.jsdelivr.net/gh/felixonmars/dnsmasq-china-list/accelerated-domains.china.conf -s | while read line; do awk -F '/' '{print $2}' | grep -v '#' ; done | paste -sd " " -`
apple=`curl https://cdn.jsdelivr.net/gh/felixonmars/dnsmasq-china-list/apple.china.conf -s | while read line; do awk -F '/' '{print $2}' | grep -v '#' ; done | paste -sd " " -`
google=`curl https://cdn.jsdelivr.net/gh/felixonmars/dnsmasq-china-list/google.china.conf -s | while read line; do awk -F '/' '{print $2}' | grep -v '#' ; done | paste -sd " " -`
echo " except $china $apple $google" >> Corefile
echo " }" >> Corefile
echo " proxy . 116.228.111.118 180.168.255.18" >> Corefile
echo " log" >> Corefile
<?php
//php gd-gif.php image.gif gd-image.gif
$gif = imagecreatefromgif($argv[1]);
imagegif($gif, $argv[2]);
imagedestroy($gif);
?>