Skip to content

Instantly share code, notes, and snippets.

View unpluggedcoder's full-sized avatar

UnpluggedCoder unpluggedcoder

View GitHub Profile
@unpluggedcoder
unpluggedcoder / pallette_bgr.py
Created October 12, 2023 06:43
Common color pallette format
# Pallette in BGR format
# Preview & reference: https://www.rapidtables.com/web/color/RGB_Color.html
ALICE_BLUE = (255, 248, 240)
ANTIQUE_WHITE = (215, 235, 250)
AQUA = (255, 255, 0)
AQUA_MARINE = (212, 255, 127)
AZURE = (255, 255, 240)
BEIGE = (220, 245, 245)
BISQUE = (196, 228, 255)
// g++ cache-prefetching.cc -Wall -std=c++11 -g -pthread -O2
#include <string>
#include <vector>
#include <mutex>
#include <random>
#include <chrono>
#include <thread>
#include <iomanip>
#include <iostream>
@HamGuy
HamGuy / delfuckthunder.sh
Created May 26, 2017 01:47
禁用迅雷的无用流氓组件
#!bin/bash
chmod a-x /Applications/Thunder.app/Contents/Bundles/XLPlayer.app
chmod a-x /Applications/Thunder.app/Contents/PlugIns/bbassistant.xlplugin
chmod a-x /Applications/Thunder.app/Contents/PlugIns/browserhelper.xlplugin
chmod a-x /Applications/Thunder.app/Contents/PlugIns/featuredpage.xlplugin
chmod a-x /Applications/Thunder.app/Contents/PlugIns/myvip.xlplugin
chmod a-x /Applications/Thunder.app/Contents/PlugIns/playgame.xlplugin
chmod a-x /Applications/Thunder.app/Contents/PlugIns/subtitle.xlplugin
chmod a-x /Applications/Thunder.app/Contents/PlugIns/thunderstore.xlplugin
@timsavage
timsavage / websocket_server.py
Last active June 27, 2023 16:58
Simple example of a websocket server with Tornado
# While this code still works, I would recommend using Fast API for websockets in modern applications.
# See: https://fastapi.tiangolo.com/advanced/websockets/
# Note this is targeted at python 3
import tornado.web
import tornado.httpserver
import tornado.ioloop
import tornado.websocket
import tornado.options
__version__ = "0.1.6.8"
if __name__ == "__main__":
import sys
import argparse
def increment_line(args):
vi = [int(i) for i in __version__.split('.')]
print('current version: %s' % __version__)
@graste
graste / strace.md
Last active November 14, 2023 12:09
strace process for network and memory and other syscalls

File activity

strace -e trace=file -fp PID (file) or strace -e trace=desc -fp PID (file descriptors)

Common calls:

  • access
  • close – close file handle
  • fchmod – change file permissions
  • fchown – change file ownership
@mfuerstenau
mfuerstenau / zigzag-encoding.README
Last active February 22, 2024 03:40
ZigZag encoding/decoding explained
ZigZag-Encoding
---------------
Maps negative values to positive values while going back and
forth (0 = 0, -1 = 1, 1 = 2, -2 = 3, 2 = 4, -3 = 5, 3 = 6 ...)
(i >> bitlength-1) ^ (i << 1)
with "i" being the number to be encoded, "^" being
XOR-operation and ">>" would be arithemtic shifting-operation
@ifels
ifels / vim_NERDTree
Last active April 8, 2023 19:12
vim NERDTree 快捷键
ctrl + w + h 光标 focus 左侧树形目录
ctrl + w + l 光标 focus 右侧文件显示窗口
ctrl + w + w 光标自动在左右侧窗口切换
ctrl + w + r 移动当前窗口的布局位置
o 在已有窗口中打开文件、目录或书签,并跳到该窗口
go 在已有窗口 中打开文件、目录或书签,但不跳到该窗口
t 在新 Tab 中打开选中文件/书签,并跳到新 Tab
T 在新 Tab 中打开选中文件/书签,但不跳到新 Tab
i split 一个新窗口打开选中文件,并跳到该窗口
gi split 一个新窗口打开选中文件,但不跳到该窗口
@tuxfight3r
tuxfight3r / 01.bash_shortcuts_v2.md
Last active May 16, 2024 18:12
Bash keyboard shortcuts

Bash Shortcuts

visual cheetsheet

Moving

command description
ctrl + a Goto BEGINNING of command line
@cleverdevil
cleverdevil / markdown-to-email
Created January 4, 2014 01:06
markdown-to-email A simple script to send beautifully formatted emails that you write in Markdown. The email will have an HTML payload and a plain-text alternative, so you'll make everyone happy, including yourself.
#!/usr/bin/env python
'''
Send an multipart email with HTML and plain text alternatives. The message
should be constructed as a plain-text file of the following format:
From: Your Name <your@email.com>
To: Recipient One <recipient@to.com>
Subject: Your subject line
---