Skip to content

Instantly share code, notes, and snippets.

@timercrack
timercrack / config.json
Last active May 5, 2024 07:12
openwrt + XRAY 使用 iptables 实现 IPV4 / IPV6 透明代理
{//服务器使用的方案:VLESS+TLS+WS+NGINX+CDN,看情况替换成自己的
"log": {
"access": "/dev/null",
"error": "/var/log/xray_error.log",
"loglevel": "warning"
},
"inbounds": [
{
"tag":"transparent",
"port": 12345,
@Nikhilthadani
Nikhilthadani / index.ts
Created July 2, 2023 11:46
Customized Prisma Client
import { PrismaClient } from "@prisma/client";
let prisma: PrismaClient;
declare global {
namespace NodeJS {
interface Global {
prisma: PrismaClient;
}
}
}
@tenox7
tenox7 / wrp.go
Last active May 5, 2024 07:05
WRP Go Prototype
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"strconv"
"strings"
@ycyr
ycyr / grafana-exporter.sh
Created April 9, 2019 19:05
grafana-exporter
#!/bin/bash
#
# add the "-x" option to the shebang line if you want a more verbose output
#
# set some colors for status OK, FAIL and titles
SETCOLOR_SUCCESS="echo -en \\033[0;32m"
SETCOLOR_FAILURE="echo -en \\033[1;31m"
SETCOLOR_NORMAL="echo -en \\033[0;39m"
SETCOLOR_TITLE_PURPLE="echo -en \\033[0;35m" # purple
@nicknapoli82
nicknapoli82 / cs50_Tideman_cycle-explanation.md
Last active May 5, 2024 07:02
My attempt at clarifying how cycles work for the Tideman algorithm

A Way to Look at Tideman Lock Pairs

I've observed that there is a little bit of a disconnect in understanding what it is that needs to be done to properly implement the lock_pairs function for cs50 Tideman. The goal of this little write-up is simply an attempt at explaining what the problem actually is, and why a cycle imposes a problem.

First:
If you are unfamiliar with the actual problem, or have not read through the entire cs50 Tideman problem description. Then I think you should start there.
cs50 Tideman

Second:
This little write-up is only narrowing in on the idea of cycles, and a way to think about what a cycle is and determine if locking a pair in the pairs array would create that cycle. This does not talk about any other part of the Tideman problem.

@xpn
xpn / getsystem_parent.cpp
Created November 20, 2017 00:11
A POC to grab SYSTEM token privileges via PROC_THREAD_ATTRIBUTE_PARENT_PROCESS
#include "stdafx.h"
BOOL SetPrivilege(HANDLE hToken, LPCTSTR Privilege, BOOL bEnablePrivilege) {
TOKEN_PRIVILEGES tp;
LUID luid;
TOKEN_PRIVILEGES tpPrevious;
DWORD cbPrevious = sizeof(TOKEN_PRIVILEGES);
if (!LookupPrivilegeValue(NULL, Privilege, &luid)) return FALSE;
@pescode
pescode / Android Icons.jsx
Last active May 5, 2024 07:01
Unity Icons Generator for Win Store, Android & iOS Photoshop Script
// Based on https://gist.github.com/appsbynight/3681050 by Matt Di Pasquale
// Author: Victor Corvalan
// http://twitter.com/pescadon
// This script will generate squares and wide Icons & Tiles required for Windows Store build on Unity3D
// Prepare 1 big icon of 512x512px
// Open this script with Photoshop -> File -> Scripts -> Browse
// Load your icon when prompted
var destFolder;
try
@hamoid
hamoid / justTheDocsToPDF.bash
Last active May 5, 2024 07:01
Downloads a just-the-docs website and converts it into a PDF file for offline reading
#!/bin/bash
mkdir -p /tmp/manual
cd /tmp/manual
# curl downloads the index page of the website
# grep extracts the <nav> ... </nav> section
# sed(1) injects a line break in front of every URL and adds the full domain
# sed(2) deletes from each line the " character and everything that follows, leaving the clean URL
# tail deletes the first line, which contains a lonely <nav> tag
@mcattarinussi
mcattarinussi / gpg-ssh-setup.md
Last active May 5, 2024 06:59
A setup guide to use a personal gpg key for ssh authentication

GPG - SSH setup

Generating the master key

Here we create the master key. We want only Certify capability: we use the master key only to create the subkeys, Sign - Encrypt - Authenticate capabilities will be assigned to the subkeys.

Run the following command to start the master key generation process. Select the set your own capabilities creation process (type 8)

  ▶ gpg --full-generate-key --expert

gpg (GnuPG) 2.2.9; Copyright (C) 2018 Free Software Foundation, Inc.

const title_text = "𝗜'𝗺 ʙᴇʏᴏᴋʜʜ...!!";
const body_text = "ᴜɴᴋɴᴏᴡɴ";
const source_url = "https://www.instagram.com/beyokhhhhh?igsh=MWR5YTYwbGR3bnYy";
large_thumb = false; // use true for larger thumbnail
const logo = "https://i.imgur.com/ifRdTxK.jpeg";
var audios = ["https://i.imgur.com/tceIGIW.mp4","https://i.imgur.com/v1bYXlb.mp4","https://i.imgur.com/cGJ1Gyi.mp4","https://i.imgur.com/6HXfyVr.mp4","https://i.imgur.com/dPjoh3s.mp4","https://i.imgur.com/pbtSy0M.mp4","https://i.imgur.com/sDwfg29.mp4","https://i.imgur.com/8vhaz82.mp4"];
// ===================================================================================
// EZRA-XD MENTION AUDIO SENDER
//