Skip to content

Instantly share code, notes, and snippets.

View Fonger's full-sized avatar

Fonger Fonger

  • Taipei, Taiwan
  • 03:57 (UTC +08:00)
View GitHub Profile
@Fonger
Fonger / is-crawler-regex.js
Created February 1, 2024 08:14
Crawler User-Agent Regex
let i=RegExp("Googlebot\\/|Googlebot-Mobile|Googlebot-Image|Googlebot-News|Googlebot-Video|AdsBot-Google([^-]|$)|AdsBot-Google-Mobile|Feedfetcher-Google|Mediapartners-Google|Mediapartners \\(Googlebot\\)|APIs-Google|bingbot|Slurp|[wW]get|LinkedInBot|Python-urllib|python-requests|aiohttp|httpx|libwww-perl|httpunit|nutch|Go-http-client|phpcrawl|msnbot|jyxobot|FAST-WebCrawler|FAST Enterprise Crawler|BIGLOTRON|Teoma|convera|seekbot|Gigabot|Gigablast|exabot|ia_archiver|GingerCrawler|webmon |HTTrack|grub.org|UsineNouvelleCrawler|antibot|netresearchserver|speedy|fluffy|findlink|msrbot|panscient|yacybot|AISearchBot|ips-agent|tagoobot|MJ12bot|woriobot|yanga|buzzbot|mlbot|YandexBot|YandexImages|YandexAccessibilityBot|YandexMobileBot|YandexMetrika|YandexTurbo|YandexImageResizer|YandexVideo|YandexAdNet|YandexBlogs|YandexCalendar|YandexDirect|YandexFavicons|YaDirectFetcher|YandexForDomain|YandexMarket|YandexMedia|YandexMobileScreenShotBot|YandexNews|YandexOntoDB|YandexPagechecker|YandexPartner|YandexRCA|YandexSearchShop|Y
@Fonger
Fonger / test.json
Last active May 26, 2020 09:43
test.json
[{"result":true}]
@Fonger
Fonger / esp-open-rtos-servo-control.c
Last active July 6, 2023 09:42
Servo Control for SG90 (0 to 180 degree) Example using esp-open-rtos
// Servo Control for SG90 (0 to 180 degree)
// MIT License Fonger
// Connect signal pin to NodeMCU D7 (GPIO13)
// add EXTRA_COMPONENTS = extras/pwm to makefile
#include <stdio.h>
#include <FreeRTOS.h>
#include <esp/uart.h>
#include <esp8266.h>
#include <task.h>
@Fonger
Fonger / lirc_raw_signal.js
Last active July 3, 2019 11:36
Sending IR Pulse with LIRC in node.js without d.conf file
/*
Copyright (c) 2019 Fonger https://github.com/Fonger
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@Fonger
Fonger / mongo.sh
Last active April 4, 2024 21:13
create an isolated mongo shell with chroot
#check dependencies
for i in `ldd /usr/bin/mongo`;do echo $i;done |grep -v = |grep -v 0x |grep /|xargs ls -l
# manually copy the lib dependencies shown above to choot path
cp xxxxx yyyyy... /path/to/root/of/chroot
# create an user without home directory & login permission
sudo useradd -M -s /bin/false mongoshell
# chroot to the shell and disable critical native method
{
"_id": "5b41b1224f963f29008b8407",
"name": "Fonger",
"username": "fonger",
"password": "$2b$10$aDVxKb.nWwyW/V1kbIfypOP83yltwmkeuO7DvIadJZ60fxGsDHogO",
"labs": [
{
"id": "testdb",
"description": "測試用",
"apiKey": "8f65263ad306bc0e0d765e3dff69fb43",

Stylebot Patterns

stylebot.me has been down for a while, so I create this gist to help those who need document on pattern settings.

Basic (default)

By default, Stylebot uses simple text strings to match styles to websites. Examples:

  • docs.google.com : Matches any URL with docs.google.com in it.
  • docs.google.com, spreadsheets.google.com : Matches any URL with docs.google.com or spreadsheets.google.com in it.

Advanced

Stylebot supports wildcards **, * and ,

@Fonger
Fonger / VMProtectSDK64.inc
Last active January 3, 2018 12:26
VMProtect 64 bit masm header file for MASM for x64(ml64.exe) on Visual Studio
; protection
VMProtectBegin PROTO :DWORD
VMProtectBeginVirtualization PROTO :DWORD
VMProtectBeginMutation PROTO :DWORD
VMProtectBeginUltra PROTO :DWORD
VMProtectBeginVirtualizationLockByKey PROTO :DWORD
VMProtectBeginUltraLockByKey PROTO :DWORD
VMProtectEnd PROTO
; utils
@Fonger
Fonger / HideModule.cpp
Last active January 5, 2023 04:15
Hide DLL ( 32bit and 64bit support)
#include "stdafx.h"
#include "HideModule.h"
std::vector<UNLINKED_MODULE> UnlinkedModules;
void RelinkModuleToPEB(HMODULE hModule)
{
std::vector<UNLINKED_MODULE>::iterator it = std::find_if(UnlinkedModules.begin(), UnlinkedModules.end(), FindModuleHandle(hModule));
if (it == UnlinkedModules.end())
@Fonger
Fonger / strlcat_strlcpy.c
Created November 22, 2015 17:42
strlcat and strlcpy for linux
#ifndef HAVE_STRLCAT
/*
* '_cups_strlcat()' - Safely concatenate two strings.
*/
size_t /* O - Length of string */
strlcat(char *dst, /* O - Destination string */
const char *src, /* I - Source string */
size_t size) /* I - Size of destination string buffer */
{