Skip to content

Instantly share code, notes, and snippets.

View recolic's full-sized avatar
🏠
Working from home

Recolic recolic

🏠
Working from home
View GitHub Profile
@qzed
qzed / Pipfile
Last active April 23, 2021 16:10
Surface Book 2 / Surface Pro (2017) / Surface Laptop UART protocol proof-of-concept script.
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]
crcmod = "*"
pyserial = "*"
[dev-packages]
@sebastien
sebastien / nix-fishgen.py
Last active May 31, 2021 02:52
Python script that converts Nix's profile bash script to Fish
#!/usr/bin/env python3
# Updated: 2018-10-17
import re, sys, os
"""
Converts the Nix profile SH script to a Fish-compatible profile using a
simple line-by-line replace algorithm.
"""
@mbinna
mbinna / effective_modern_cmake.md
Last active June 26, 2024 13:26
Effective Modern CMake

Effective Modern CMake

Getting Started

For a brief user-level introduction to CMake, watch C++ Weekly, Episode 78, Intro to CMake by Jason Turner. LLVM’s CMake Primer provides a good high-level introduction to the CMake syntax. Go read it now.

After that, watch Mathieu Ropert’s CppCon 2017 talk Using Modern CMake Patterns to Enforce a Good Modular Design (slides). It provides a thorough explanation of what modern CMake is and why it is so much better than “old school” CMake. The modular design ideas in this talk are based on the book [Large-Scale C++ Software Design](https://www.amazon.de/Large-Scale-Soft

@recolic
recolic / go-get-for-china.py
Last active August 9, 2019 03:01
go-get golang.org/x/... will run perfectly!
#!/bin/env python3
# by Recolic Keghart, Nov 16
import sys
import os
import subprocess
if len(sys.argv) < 2:
print('Error: go-get-for-china <pkg path>')
exit(1)
@atao
atao / RunAsAdmin.ps1
Last active October 1, 2023 19:34
🕵️ Self privileges escalation with PowerShell.
#Requires -RunAsAdministrator
#OneLine
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs; exit }
#Or
$Loc = Get-Location
"Security.Principal.Windows" | % { IEX "( [ $_`Principal ] [$_`Identity ]::GetCurrent() ).IsInRole( 'Administrator' )" } | ? {
$True | % { $Arguments = @('-NoProfile','-ExecutionPolicy Bypass','-NoExit','-File',"`"$($MyInvocation.MyCommand.Path)`"","\`"$Loc\`"");
Start-Process -FilePath PowerShell.exe -Verb RunAs -ArgumentList $Arguments; } }
@kookxiang
kookxiang / hackQQ.sh
Last active June 19, 2024 12:01
一键得到一个精简版的手机QQ(Android)
#!/system/bin/sh
# 使用方法:
# adb shell "curl -Ssl https://gist.githubusercontent.com/kookxiang/1104e898f270c9a7a0784f70979ec532/raw/hackQQ.sh | su"
# 使用方法 (手动):
# 0.确保你手机 Root 了
# 1.下载这个脚本到某个地方
# 2.下载 Android SDK(需要其中的 adb)
# 3.在命令行运行 adb devices,确保能看到你的手机
@Itwastaken
Itwastaken / OpenVPN-2.2.2-obfs.patch
Created June 6, 2016 06:47 — forked from greensea/OpenVPN-2.2.2-obfs.patch
The obfs patch obsfucate OpenVPN traffic, make it looks like random traffic. The obfs patch add two options for OpenVPN. --obfs-salt <string> is a secret to generate the input XOR stream. To enable the obfs patch, this options must be set. --obfs-padlen <num> is a positive integer max to 255. This option tells obfs patch to padding random conten…
--- openvpn-2.2.2.orig/options.c 2011-12-14 00:58:56.000000000 +0800
+++ openvpn-2.2.2/options.c 2012-12-21 10:44:57.683130505 +0800
@@ -54,6 +54,10 @@
#include "memdbg.h"
+extern char* _socket_obfs_salt;
+extern int _socket_obfs_salt_len;
+extern int _socket_obfs_padlen;
+
@edokeh
edokeh / index.js
Last active June 27, 2024 04:27
佛祖保佑,永无 BUG
//
// _oo0oo_
// o8888888o
// 88" . "88
// (| -_- |)
// 0\ = /0
// ___/`---'\___
// .' \\| |// '.
// / \\||| : |||// \
// / _||||| -:- |||||- \
@wcp1231
wcp1231 / guess_number.py
Last active April 6, 2017 08:29
豆瓣小组里的一道题目:随机一个四位数(四数字互不重复)让游戏者去猜,猜的数字中某一位猜对记做一个A,如果游戏者提交的数字中有数字属于被猜数字中的一个但位置不对则记为B。如 生成的数学为:1234 猜 9241 返回 1A2B 猜5678 返回0A0B 拿来练手练手。
import random
all_number = [str(i) for i in range(1, 10)]
get_number_A = lambda p, g: len(filter(lambda x: x[0] == x[1], zip(p, g)))
get_number_B = lambda p, g: len(filter(lambda x: x in p, g))
puzzle = random.sample(all_number, 4)
guess = list(raw_input())
@UniIsland
UniIsland / SimpleHTTPServerWithUpload.py
Created August 14, 2012 04:01
Simple Python Http Server with Upload
#!/usr/bin/env python
"""Simple HTTP Server With Upload.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
"""