Skip to content

Instantly share code, notes, and snippets.

View emcifuntik's full-sized avatar
🏀
Playing basketball

Yauhen Pahrabniak emcifuntik

🏀
Playing basketball
View GitHub Profile
@emcifuntik
emcifuntik / tunnel.sh
Last active December 23, 2023 18:52
Automatic script for installing L2TP tunnel on Linux server
#!/bin/bash
# Function to generate a random password
generate_password() {
tr -dc A-Za-z0-9 </dev/urandom | head -c 12
}
# Function to install necessary packages and configure VPN
install_vpn() {
echo "Updating repositories..."
@emcifuntik
emcifuntik / worker.ts
Created December 16, 2023 11:08
Cloudflare QA Auth
// src/worker.ts
var worker_default = {
async fetch(request, env, ctx) {
const url = new URL(request.url);
const key = url.pathname.slice(1);
if (request.method == "POST" && key == "new-token" && request.headers.has("Security") && request.headers.get("Security") == "secret_token") {
const json = await request.json();
await env.QA_KV_NAMESPACE.put("auth:" + json["new_token"], "access", { expirationTtl: 86400 });
return new Response(JSON.stringify({ success: true }));
}
#!/usr/bin/ruby
#
# This tool is only used to "decrypt" the github enterprise source code.
#
# Run in the /data directory of the instance.
require "zlib"
require "byebug"
KEY = "This obfuscation is intended to discourage GitHub Enterprise customers "+
@emcifuntik
emcifuntik / InlineStackTrace.h
Created August 26, 2021 14:56
Unreal Engine any place stack trace
#define STACKTRACE() { constexpr SIZE_T StackTraceSize = 65535; \
ANSICHAR* StackTrace = static_cast<ANSICHAR*>(FMemory::Malloc(StackTraceSize)); \
StackTrace[0] = '\0'; \
FPlatformStackWalk::StackWalkAndDump(StackTrace, StackTraceSize, 0); \
const FString StackTraceString(StackTrace); \
TArray<FString> Lines; \
StackTraceString.ParseIntoArrayLines(Lines); \
UE_LOG(LogTemp, Warning, TEXT(" -- %s %p StackTrace Begin -- "), TEXT(__FUNCSIG__), this); \
for (const FString& Line : Lines) \
{ \
@emcifuntik
emcifuntik / wt_context_menu
Created May 23, 2020 23:57
Terminal from Windows Store in context menu
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\shell\runas]
@="Open terminal here (Administrator)"
"Icon"="cmd.exe"
[HKEY_CLASSES_ROOT\Directory\shell\runas\command]
@="cmd.exe /s /c \"start %%USERPROFILE%%\\AppData\\Local\\Microsoft\\WindowsApps\\wt.exe -d \"%V\"\""
[HKEY_CLASSES_ROOT\Directory\Background\shell\runas]
@emcifuntik
emcifuntik / jhash.sql
Last active August 3, 2018 19:24
Jenkins One-At-A-Time Hash algorithm for MySQL as stored function
CREATE FUNCTION `jhash` (str TEXT)
RETURNS INTEGER UNSIGNED
READS SQL DATA
DETERMINISTIC
BEGIN
DECLARE hashSum INTEGER UNSIGNED;
DECLARE i INTEGER(4) UNSIGNED;
DECLARE charCode INTEGER(4) UNSIGNED;
SET @MaxUInt = 4294967296;
SET hashSum = 0;
<div class="logo">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="340px" height="249px" viewbox="0 0 340 249">
<path fill-rule="evenodd" fill="rgb(255, 255, 255)"
d="M284.824,182.622 C284.824,199.723 290.408,210.891 303.670,210.891 C314.489,210.891 322.167,206.005 327.751,201.817 L339.966,232.878 C330.543,240.556 313.791,248.234 293.549,248.234 C257.951,248.234 244.689,225.200 244.689,185.065 L244.689,44.069 L284.824,44.069 L284.824,87.694 L335.429,87.694 L335.429,125.386 L284.824,125.386 L284.824,182.622 ZM194.784,248.234 C170.703,248.234 157.790,233.576 157.790,201.468 L157.790,0.444 L197.925,0.444 L197.925,185.065 C197.925,202.864 202.112,210.542 211.535,210.542 C217.817,210.542 223.052,207.750 227.938,204.260 L236.314,234.972 C227.240,242.301 213.629,248.234 194.784,248.234 ZM95.668,226.596 C87.292,238.462 70.540,246.838 49.251,246.838 C20.633,246.838 0.043,229.039 0.043,198.676 C0.043,164.125 25.519,147.722 57.278,147.722 C71.238,147.722 85.198,152.259 92.87