Skip to content

Instantly share code, notes, and snippets.

View itpcc's full-sized avatar
😶
Planting commit forest...

Rachasak Ragkamnerd itpcc

😶
Planting commit forest...
View GitHub Profile
@itpcc
itpcc / mtd-spam-report.js
Last active February 19, 2024 17:50
Mass report Mastodon spam by notification threshold
// Paste the following script in the web's console.
// CHANGE BEFORE RUN! USe AT YOUR OWN RISK!
const fromDate = new Date('2024-02-01T07:00:00.000Z'); // February 1st, 2024
const toDate = new Date('2024-02-14T07:00:00.000Z'); // February 14th, 2024
for (const targetNoti of document.querySelectorAll('#mastodon [aria-label="Notifications"] .status')) {
const postTime = new Date(targetNoti.querySelector('.status__info time').getAttribute('datetime'));
if (postTime < fromDate || postTime > toDate) continue;
targetNoti.querySelector('.status__action-bar .status__action-bar__dropdown button').click();
@itpcc
itpcc / LayoutFix.py
Last active December 3, 2023 15:50
layoutFix.exe on Linux Mint using AutoKey
LOOKUP_TBL_US = '~!@#$%^&*()_+`1234567890-=QWERTYUIOP{}|qwertyuiop[]\ASDFGHJKL:"asdfghjkl;\'ZXCVBNM<>?zxcvbnm,./'
LOOKUP_TBL_TH = '%+๑๒๓๔ู฿๕๖๗๘๙_ๅ/-ภถุึคตจขช๐"ฎฑธํ๊ณฯญฐ,ฅๆไำพะัีรนยบลฃฤฆฏโฌ็๋ษศซ.ฟหกดเ้่าสวง()ฉฮฺ์?ฒฬฦผปแอิืทมใฝ'
origText = clipboard.get_selection()
# https://superuser.com/a/1432982
langCode = system.exec_command("xset -q | grep LED | awk '{ print $10 }'", getOutput=True)
crctText = ''
for ot in origText:
lkuPos = -1
@itpcc
itpcc / README.md
Last active November 30, 2023 05:32
How I configure my Cisco CP-6921 to use with my FreePBX

Why

Recently, I've buy a "new old stock" Cisco CP-6921 in order to replace my old POTS phone used in conjunction with my FXS that I've configured not long ago. So, as Cisco do their best, it's not straightforwardly to configured without their proprietary softwares. Fortunately, there's tons of resources to help and, finally, got me through and got it done. So, to help alleviate the pain that I've gone through, I decide to, once again, write this memo.

Disclaimers

This is how I done, not a tutorial. Use your own discrestion. I won't take any responsibility if things break.

Pre-requirements

@itpcc
itpcc / README-caller_id-grandstream-ht-813-freepbx16.md
Last active June 10, 2023 15:13
How to configure incoming caller ID for Grandstream HT-813 to FreePBX16

Why?

Recently, I've install FreePBX and its hardwares to allow recording and (potentially, if I'm not too lazy enough) have a call-centre for future business.

I use Grandstream HT-813 for a FXO (converting PSTN from, idiotically, AIS VoIP landline service) and FXS with exisiting home telephone so I can make a call from my condominium.

However, even with configuration I follow Crosstalk Solution's video series and this tutorial and got both incoming and outgoing calls, I still can't record incoming caller ID.

How?

@itpcc
itpcc / README.md
Created January 14, 2023 05:34
Greenshot: Decode QR code from the screenshot

How?

  1. Install Python 3 (I use 3.10)
  2. Run the following command (to install dependencies)
python3 -m pip install --upgrade pyzbar Pillow pyperclip
  1. Copy main.py to C:\qrcode-decode (Or whereever, just being able to run from command line)
  2. On Greenshot's icon located in the taskbar, right click and click "Configure external commands" image
  3. On "External command settings" window, click "New" button.
@itpcc
itpcc / UDP Server.py
Created May 11, 2018 16:24
UDP server for Mini-project: Cellular Tower logger
#!/usr/bin/python3
import datetime
import asyncio
import os
import firebase_admin
from firebase_admin import credentials
from firebase_admin import firestore
# Use a service account
cred = credentials.Certificate('./firebase-credential.json')
@itpcc
itpcc / How I compress data for UDP.c
Created May 11, 2018 16:20
Data formatting for Mini-project: Cellular Tower logger
int format(){
data = "C,";
data += ultoa(seq, numberBuffer, 36);
data += ','; data += String(ultoa(strtoul(networkCode.c_str(), (char **)NULL, 10), numberBuffer, 36));
data += ","; data += String(utoa (networkInfo.TAC, numberBuffer, 36));
data += ","; data += String(ultoa(networkInfo.ECI, numberBuffer, 36));
data += ','; data += String(utoa (
strtoul(networkSignalQuality.csq.c_str(), (char **)NULL, 10),
numberBuffer,
36
@itpcc
itpcc / GPSHelpers.h
Created May 11, 2018 16:14
GPS Helper function for Mini-project: Cellular Tower logger
/***** GPS Helper function *****/
char* getGPGGA(){
unsigned long startTime = millis();
char ch = '\0';
char *newline;
size_t len;
memset(strBuffer, '\0', 121);
do{
while(

Keybase proof

I hereby claim:

  • I am itpcc on github.
  • I am itpcc (https://keybase.io/itpcc) on keybase.
  • I have a public key whose fingerprint is 3F52 CC8D 3A91 026A 1FD1 895D 2D92 37A9 E307 914D

To claim this, I am signing this object:

#include <AntoIO.h>
#include <dht11.h>
#define DHT11PIN 12
#define GPIO15 15
dht11 DHT11;
// change ssid and password to yours
const char* ssid = "aisfibre2704_2.4G";
const char* password = "6FF56B76";