Skip to content

Instantly share code, notes, and snippets.

@GunGunGun
GunGunGun / svg-to-png.js
Created April 27, 2024 16:32 — forked from camman3d/svg-to-png.js
Convert SVG to PNG. Verified in Chrome, Safari, and Firefox
// let svg = document.querySelector('svg');
function svgToPng(svg) {
let svgData = new XMLSerializer().serializeToString(svg);
let canvas = document.createElement('canvas');
let ctx = canvas.getContext('2d');
let DOMURL = window.URL || window.webkitURL || window;
let img = new Image();
let blog = new Blob([svgData], {type: 'image/svg+xml'});
let url = DOMURL.createObjectURL(blog);
@GunGunGun
GunGunGun / record.py
Created April 7, 2024 14:35 — forked from korakot/record.py
Record audio in Colab using getUserMedia({ audio: true })
# all imports
from IPython.display import Javascript
from google.colab import output
from base64 import b64decode
from io import BytesIO
!pip -q install pydub
from pydub import AudioSegment
RECORD = """
const sleep = time => new Promise(resolve => setTimeout(resolve, time))
@GunGunGun
GunGunGun / Index.html
Created April 7, 2024 14:02 — forked from meziantou/Index.html
Javascript - Record audio
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body>
<h1>Audio</h1>
@GunGunGun
GunGunGun / m3u8-to-youtube-live.md
Created March 22, 2024 00:44 — forked from qntmpkts/m3u8-to-youtube-live.md
Restream m3u8 stream with ffmpeg to youtube live

Setup YouTube Live Event

Head on over to your YouTube live Events page (https://www.youtube.com/my_live_events).

Create a new live event that is unlisted (or private) and of Custom type.

Under Basic ingestion choose 1500 Kbps - 4000 kbps (720p).

Check the Enable 60fps box.

😀 grinning face
😃 grinning face with big eyes
😄 grinning face with smiling eyes
😁 beaming face with smiling eyes
😆 grinning squinting face
😅 grinning face with sweat
🤣 rolling on the floor laughing
😂 face with tears of joy
🙂 slightly smiling face
🙃 upside-down face
@GunGunGun
GunGunGun / postgres_command.md
Created March 20, 2024 03:47 — forked from oNguyenNgocTrung/postgres_command.md
Tổng hợp những câu lệnh khi dùng Postgres SQL
@GunGunGun
GunGunGun / threadpoolss.py
Created March 16, 2024 09:34 — forked from kgaughan/threadpoolss.py
All the thread pool mixins for SocketServer are, well, not that good, so I knocked together my own. This one can cleanly shut down the pool
"""
Thread pool extensions to SocketServer.
"""
import Queue
import SocketServer
import sys
import threading
@GunGunGun
GunGunGun / image_to_text.js
Created March 3, 2024 01:21 — 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);
@GunGunGun
GunGunGun / 1-init.cmd
Created March 2, 2024 17:27 — forked from RobbiNespu/1-init.cmd
Portable postgre SQL on windows
@ECHO ON
:: Save the directory where we are
pushd %CD%
echo %CD%
:: Shift directories to the correct path
%~d0
cd %~dp0