Skip to content

Instantly share code, notes, and snippets.

View demon071's full-sized avatar

Văn Anh demon071

View GitHub Profile
@demon071
demon071 / image_to_text.js
Created April 11, 2024 02:25 — forked from NoCtrlZ1110/image_to_text.js
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);
@demon071
demon071 / autotranslate_hardsubs.py
Created March 13, 2024 13:40 — forked from kumorikuma/autotranslate_hardsubs.py
Takes as input a video with hardsubs, and will generate translated softsubs in the target language
# Requirements:
# - ImageMagick binary
# - Windows.Media.Ocr.Cli binary
# - VideoSubFinder binary
#
# Official GCloud Translate Setup:
# First 500k characters / mo is free: https://cloud.google.com/translate/pricing
# Install Python Module: pip install google-cloud-translate
# Setup Google Cloud account and billing information: https://cloud.google.com/
# Make a new project and enable "Cloud Translation API": https://console.cloud.google.com/apis/dashboard
@demon071
demon071 / recover_source_code.md
Created April 2, 2023 15:59 — forked from simonw/recover_source_code.md
How to recover lost Python source code if it's still resident in-memory

How to recover lost Python source code if it's still resident in-memory

I screwed up using git ("git checkout --" on the wrong file) and managed to delete the code I had just written... but it was still running in a process in a docker container. Here's how I got it back, using https://pypi.python.org/pypi/pyrasite/ and https://pypi.python.org/pypi/uncompyle6

Attach a shell to the docker container

Install GDB (needed by pyrasite)

apt-get update && apt-get install gdb
@demon071
demon071 / certbotresetcert.sh
Created December 17, 2022 10:07 — forked from zoharbabin/certbotresetcert.sh
Delete and reinstall SSL certificates with certbot on Ubuntu
certbot certificates
# find the path to the fullchain certificate you wish to reinstall
certbot revoke --cert-path /etc/letsencrypt/live/... #path to the cert from above
certbot delete --cert-name yourdomain.com
rm -Rf /etc/apache2/sites-available/000-default-le-ssl.conf #or whatever the name of the apache conf you had it configured on
rm -Rf 000-default-le-ssl.conf #or whatever the name of the apache conf you had it configured on
sudo apache2ctl restart
certbot #follow the guide to setup the new certificate
@demon071
demon071 / device.txt
Last active July 31, 2022 09:02
danh sách thiết bị
os_api=22&device_type=SM-N976N&ssmix=a&manifest_version_code=2022105060&dpi=240&uoo=0&carrier_region=VN&region=VN&app_name=musical_ly&version_name=21.5.6&timezone_offset=25200&ts=1652417007&ab_version=21.5.6&residence=VN&cpu_support64=false&current_region=VN&ac2=wifi&app_type=normal&ac=wifi&host_abi=armeabi-v7a&update_version_code=2022105060&channel=googleplay&_rticket=1652417009021&device_platform=android&iid=7097076452981491482&build_number=21.5.6&locale=vi-VN&op_region=VN&version_code=210506&timezone_name=Asia%2FBangkok&cdid=7d986515-4f2e-4ba4-9e43-4274217546cf&openudid=c4d71f7f8fbe0edb&sys_region=VN&device_id=7002160125201073669&app_language=vi&resolution=540*960&os_version=5.1.1&language=vi&device_brand=samsung&aid=1233&mcc_mnc=45204
@demon071
demon071 / fb-video-downloader-script.js
Created July 15, 2022 08:25 — forked from monokaijs/fb-video-downloader-script.js
A small snippet to help you download Facebook video at ease...
/**
** Author: @MonokaiJs
** Contact: [email protected] | https://fb.me/monokaijssss | monokaijs.com
**
** Free to use, but don't abuse :>
**/
(()=>{let a=location.href.match(/\/(?:videos|reel|watch)(?:\/?)(?:\?v=)?(\d+)/);if(a.length<2){console.log("Please open a video before running this script.");return}let c=function(d,e){let f=[],a;for(a in d)if(d.hasOwnProperty(a)){let g=e?e+"["+a+"]":a,b=d[a];f.push(null!==b&&"object"==typeof b?c(b,g):encodeURIComponent(g)+"="+encodeURIComponent(b))}return f.join("&")},b=function(a,b){return fetch("https://www.facebook.com/api/graphql/",{method:"POST",headers:{"content-type":"application/x-www-form-urlencoded"},body:c({doc_id:a,variables:JSON.stringify(b),fb_dtsg:require("DTSGInitialData").token,server_timestamps:!0})})};console.log("Getting info..."),b("5279476072161634",{UFI2CommentsProvider_commentsKey:"CometTahoeSidePaneQuery",caller:"CHANNEL_VIEW_FROM_PAGE_TIMELINE",displayCommentsContextEnableComment:null,displayCommentsContextIsAdPreview:null,displayComm