Skip to content

Instantly share code, notes, and snippets.

View ThomazPom's full-sized avatar

ThomazPom ThomazPom

View GitHub Profile
@ThomazPom
ThomazPom / auto_answer.js
Created May 8, 2021 10:36
Auto answer on facebook page inbox
// ==UserScript==
// @name FAQ AutoAnswer
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @grant none
// ==/UserScript==
var nlist = [];
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<style>
body{
background-color:#000048;
color:white;
<?php
foreach ([1] as $i) if ($condition) { // Breakable if
//some code
$a = "b";
// Le break
break;
// code below will not be executed
}
for ($i=0; $i < 1 ; $i++) if ($condition) {
//some code
@ThomazPom
ThomazPom / gimp_smart_remove_bg.py
Last active September 1, 2022 20:07
Execute this in gimp python fu console to remove black backgrounds from png images while keeping accurate colors
import glob, os
def smart_remove_bg(folder,rem_color="#000000"):
for filename in glob.glob(folder.replace('"','').strip()):
out_fname = os.path.join(os.path.dirname(filename),"out-"+os.path.basename(filename))
out_fname_xcf = os.path.join(os.path.dirname(filename),"xcf-"+os.path.basename(filename)+".xcf")
image = pdb.file_png_load(filename, filename)
drawable = pdb.gimp_image_get_active_drawable(image)
pdb.plug_in_colortoalpha(image, drawable, rem_color)
#include <RCSwitch.h>
RCSwitch mySwitch = RCSwitch();
int emit(int value=1008,int protocol=6,int wordlen=12)
{
String must_send = intToBinaryWord(value,wordlen);
function discoverAllShadowRoots(){
let shadowroots = []
function discover(elem){
let elemshadowroots = [...elem.querySelectorAll("*")]
elemshadowroots.push(elem)
elemshadowroots=elemshadowroots.map(z=>z.shadowRoot).filter(z=>z)
elemshadowroots.forEach(discover)
shadowroots.push(...elemshadowroots)
}
var audioCtx = new (window.AudioContext || window.webkitAudioContext)();
function playNote(frequency, duration,cancontinue) {
// create Oscillator node
var oscillator = audioCtx.createOscillator();
oscillator.type = 'square';
oscillator.frequency.value = frequency; // value in hertz
oscillator.connect(audioCtx.destination);
oscillator.start();
const { execSync } = require('child_process');
function deleteWorkflowRuns(username, reponame) {
if (!username || !reponame) {
console.log("Usage: deleteWorkflowRuns(username, reponame)");
return 1;
}
console.log(`Fetching workflow runs for ${username}/${reponame}...`);

USB Video Capture with FFmpeg

This guide explains how to capture video and audio from a USB capture device and process it using FFmpeg in two steps. The current method captures video at a custom frame rate with sound, followed by a second step to process the video.

Step 1: Capture Video and Audio

The first command captures both video and audio using a USB video capture device and a virtual audio source. It records the video at 34 frames per second for 200 seconds.

ffmpeg -f dshow -rtbufsize 100M -i video="usb video" -f dshow -i audio="virtual-audio-capturer" -preset ultrafast -framerate 34 -t 200 -y output2.mp4

SSL Certificate Generation Script

This script generates a self-signed root CA certificate and a server certificate using OpenSSL. It also includes subject alternative names (SANs) for custom DNS entries. The commands are structured to create certificates valid for 100 years (36500 days).

Steps:

  1. Define Subject for Certificates: The suj variable defines the subject for the certificate.

suj="//appcompat=1/C=FR/ST=PACA/L=AP/O=$cname/OU=Securite/CN=Thomas Benhamou/emailAddress=$username@$cname.com"