Skip to content

Instantly share code, notes, and snippets.

@ishad0w
ishad0w / sources.list
Created August 20, 2023 09:36
Debian 12 (Bookworm) -- Full sources.list and debian.sources
deb http://deb.debian.org/debian/ bookworm main contrib non-free non-free-firmware
deb http://deb.debian.org/debian/ bookworm-updates main contrib non-free non-free-firmware
deb http://deb.debian.org/debian/ bookworm-backports main contrib non-free non-free-firmware
deb http://security.debian.org/debian-security/ bookworm-security main contrib non-free non-free-firmware
@muink
muink / NCSI.md
Created November 20, 2021 09:15
常見網絡連接狀態指示器 (NCSI) 及強制門戶 (Captive Portal) 認證

常見網絡連接狀態指示器 (NCSI) 及強制門戶 (Captive Portal) 認證地址

常見網絡連接狀態指示器 (NCSI) 檢測用網絡地址

  • Windows:
    • Edge:
      • http(s)://edge.microsoft.com/captiveportal/generate_204 HTTP連接檢測, 有效值為204
    • 10-11:
      • http://www.msftconnecttest.com/connecttest.txt HTTP下載檢測, 有效值為Microsoft Connect Test
@jezman
jezman / restart-network.sh
Last active October 24, 2024 07:55
PROXMOX: Apply network settings without reboot.
#/bin/bash
if [[ "$EUID" -ne 0 ]]; then
echo "Permission denied"
exit 1
fi
cp /etc/network/interfaces /etc/network/interfaces.new
systemctl restart networking.service
@ccentauri
ccentauri / SignatureChecker.cpp
Last active November 16, 2021 13:05 — forked from wujinyuan/com_example_gist_SignatureChecker.cpp
Get app package signature without JNICALL
jobject getContext(JNIEnv *env) {
jclass jAppAppGlobalsClass = env->FindClass("android/app/AppGlobals");
jmethodID jGetInitialApplication = env->GetStaticMethodID(jAppAppGlobalsClass, "getInitialApplication",
"()Landroid/app/Application;");
jobject jApplicationObject = env->CallStaticObjectMethod(jAppAppGlobalsClass, jGetInitialApplication);
return jApplicationObject;
}
@trevershick
trevershick / CMakeLists.txt
Last active November 21, 2023 06:54
Simple client and server using libuv and unix domain sockets...
set(CMAKE_BUILD_TYPE Debug)
cmake_minimum_required(VERSION 2.8.12)
project(libuv1)
add_definitions("-std=c++11")
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()
add_executable(server server.cpp)
@yougg
yougg / proxy.md
Last active November 17, 2024 03:28
complete ways to set http/socks/ssh proxy environment variables

set http or socks proxy environment variables

# set http proxy
export http_proxy=http://PROXYHOST:PROXYPORT

# set http proxy with user and password
export http_proxy=http://USERNAME:PASSWORD@PROXYHOST:PROXYPORT

# set http proxy with user and password (with special characters)
@ovichiro
ovichiro / tomcat-linux.service.md
Last active August 8, 2024 02:24
Tomcat as a service on Linux

Install Tomcat as a service on Linux

Download Tomcat from the Apache website.
Unpack in /opt/apache-tomcat-x.y.z. E.g. /opt/apache-tomcat-8.5.6.
You'll need a terminal and root access.

Create Tomcat user with restricted permissions

Libuv and libev, two I/O libraries with similar names, recently had the privilege to use both libraries to write something. Now let's talk about my own subjective expression of common and different points.

The topic of high-performance network programming has been discussed. Asynchronous, asynchronous, or asynchronous. Whether it is epoll or kqueue, it is always indispensable to the asynchronous topic.

Libuv is asynchronous, and libev is synchronous multiplexing IO multiplexing.

Libev is a simple encapsulation of system I/O reuse. Basically, it solves the problem of different APIs between epoll and kqueuq. Ensure that programs written using livev's API can run on most *nix platforms. However, the disadvantages of libev are also obvious. Because it basically just encapsulates the Event Library, it is inconvenient to use. For example, accept(3) requires manual setnonblocking after connection. EAGAIN, EWOULDBLOCK, and EINTER need to be detected when reading from a socket. This is a

@retspen
retspen / pf_nat
Created March 2, 2018 18:27
Enable NAT on macOS
#!/bin/bash
cat > /usr/local/etc/pf-nat.conf << EOF
nat on en0 from vnic1:network to any -> (en0)
EOF
sudo pfctl -d
sudo sysctl -w net.inet.ip.forwarding=1
sudo pfctl -f /usr/local/etc/pf-nat.conf -e
@drmalex07
drmalex07 / README-tomcat-as-systemd-service.md
Last active September 25, 2024 20:09
An example configuration for Tomcat as systemd service. #tomcat #systemd #systemd.service

README

Let Tomcat is download and installed under /opt/tomcat. Also, let tomcat be a non-provileged user under which the server will be running.

We assume that we keep server's binaries under /opt/tomcat and we will create a server instance named foo under /var/tomcat/ (carrying its own conf, logs, webapps, work, lib directories). See also https://dzone.com/articles/running-multiple-tomcat.

Create a template service unit file at /etc/systemd/system/[email protected]: