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 June 25, 2024 13:22
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 )
{
@dreamcat4
dreamcat4 / ikev2.xml
Created June 11, 2021 18:15 — forked from dapao9999/ikev2.xml
IKEv2 VPN profile for Apple devices, Pre-Shared Key(PSK)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<!-- IKEv2 IPSec VPN profile for Apple devices, Pre-Shared Key(PSK), no username password.
References:
https://wiki.strongswan.org/projects/strongswan/wiki/AppleIKEv2Profile
https://developer.apple.com/library/mac/featuredarticles/iPhoneConfigurationProfileRef/Introduction/Introduction.html
https://help.apple.com/configurator
The extension of this file should be .mobileconfig -->
@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