Skip to content

Instantly share code, notes, and snippets.

@NoCtrlZ1110
NoCtrlZ1110 / image_to_text.js
Created January 18, 2024 07:57
Extract text from image using Google Lens API
const fs = require('fs');
const axios = require('axios');
const FormData = require('form-data');
// Function to read the image file as a buffer
const readImageFile = (filePath) => {
return new Promise((resolve, reject) => {
fs.readFile(filePath, (err, data) => {
if (err) {
reject(err);
@Paraphraser
Paraphraser / Checking your Raspberry Pi's view of its power supply.md
Created June 13, 2022 06:53
Checking your Raspberry Pi's view of its power supply (sometimes it's not the wall-wart)

Checking your Raspberry Pi's view of its power supply

Sometimes it seems like the first (and sometimes only) advice you get offered for almost any problem with a Raspberry Pi is "check your power supply". You think something like:

"hey, I'm using an official power supply sold as being matched with my Pi so how can there be any problem?"

You look up the specs then stick a controlled load across your supply and confirm that it can deliver the required number of Watts.

Yet your problems persist…

@ynkdir
ynkdir / clangdump.py
Last active August 25, 2022 11:24
Python bindings for Win32 API generated using clang
import sys
import clang.cindex
clang.cindex.Config.set_library_path(r'C:\Program Files\LLVM\bin')
def visit(cursor, indent):
print("%s[KIND:%s] { extent: { File:%s, start:{ l:%d, c:%d }, end {l:%d, c:%d } } , spelling:%s, type:{ kind:%s, spelling:%s } }" % (
' ' * indent,
cursor.kind.name,
cursor.extent.start.file,
@eyecatchup
eyecatchup / calc-sapisidhash.js
Created April 14, 2022 07:39
Calculate SAPISIDHASH
async function getSApiSidHash(SAPISID, origin) {
function sha1(str) {
return window.crypto.subtle.digest("SHA-1", new TextEncoder("utf-8").encode(str)).then(buf => {
return Array.prototype.map.call(new Uint8Array(buf), x=>(('00'+x.toString(16)).slice(-2))).join('');
});
}
const TIMESTAMP_MS = Date.now();
const digest = await sha1(`${TIMESTAMP_MS} ${SAPISID} ${origin}`);
@bmatthewshea
bmatthewshea / certbot_pip_install-debian_ubuntu.md
Last active May 2, 2024 13:43
Debian/Ubuntu - CERTBOT without SNAP/SNAPD

CERTBOT - Install using Python PIP

Install Certbot using Python PIP (Package Installer for Python) - without using SNAP, APT or SYSTEMD. (Debian/Ubuntu)


This guide will help you install LetsEncrypt / Certbot using venv PIP under Debian/Ubuntu.

  • This guide has been tested up to Debian 12 / Bookworm.
@Tocchann
Tocchann / RunMessageLoop_MsgWaitForMultipleObjects.cpp
Last active August 3, 2022 13:21
MsgWaitForMultipleObjects の例
#include <map>
#include <functional>
// waitActions に登録する例は載せていない(通常は、排他制御して追加処理するのが良い)
std::map<HANDLE, std::function<bool(bool,bool&)>> waitActions;
DWORD APIENTRY SetupWaitHandles( HANDLE* waitHandles, DWORD capacityCount )
{
DWORD waitCount = 0;
if( capacityCount > 0 )
{
@fi01
fi01 / SO-02J_BLU_Root_Docomo.txt
Created October 24, 2020 08:13
SO-02JのBLUとRoot化メモ(Docomoファーム)
アンロック前のバックアップ
Flashtool 0.9.25.0で34.1.B.0.336を焼く
TA領域をBackupTA_v2で取得
BLU準備
qUnlock Toolsでアンロック
サービスメニューのConfigurationで値の確認
「Bootloader unlock allowed: Yes」
この状態のTA領域をBackupTA_v2で取得
@jangxx
jangxx / extract_pdf_layers.py
Created October 7, 2020 16:32
Extract all the layers of a PDF file into their own files
#!/usr/bin/env python3
import sys
import pikepdf
if len(sys.argv) < 3:
print("Usage: extract_layers.py <input.pdf> <output_template>")
print()
print("Output template has to contain {num} somewhere, which will be replaced by the layer number.")
sys.exit(0)
@nojaja
nojaja / ScriptAutoRunner.png
Last active December 11, 2023 08:30
youtube広告削除ツール
ScriptAutoRunner.png
@rguliev
rguliev / convert_pdf.py
Last active March 25, 2024 21:12 — forked from terencezl/convert_pdf.py
Python 3: pdfminer code to convert pdf to text, html or xml
# Use `pip3 install pdfminer.six` for python3
from typing import Container
from io import BytesIO
from pdfminer.pdfinterp import PDFResourceManager, PDFPageInterpreter
from pdfminer.converter import TextConverter, XMLConverter, HTMLConverter
from pdfminer.layout import LAParams
from pdfminer.pdfpage import PDFPage