Skip to content

Instantly share code, notes, and snippets.

View katopz's full-sized avatar
🦀
Rust me if you can

Todsaporn Banjerdkit katopz

🦀
Rust me if you can
View GitHub Profile
@katopz
katopz / photopea-hide-ads.md
Last active April 16, 2024 04:48
How to hide photopea ads

Open console and run this for 0px width ads. (ads still working, adjust width size to suite your need)

document.querySelector("body > div.flexrow.app > div:nth-child(2)").setAttribute('style','max-width:0px')

document.querySelector("body > div.flexrow.app > div").setAttribute('style','width:100%')
document.querySelector("body > div.flexrow.app > div > div.flexrow > div.panelblock.mainblock").setAttribute('style','width:100%')
const style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = '.fixme { min-width:fit-content;overflow:unset; }';
document.querySelector("body > div.flexrow.app > div:nth-child(1) > div.flexrow").appendChild(style)
@katopz
katopz / gql_search_stargazers.gql
Created November 26, 2016 04:54
GraphQL Github Example : Search for top ten stargazers
// Try at : https://graphql-explorer.githubapp.com/
{
search(query: "language:JavaScript stars:>10000", type: REPOSITORY, first: 10) {
repositoryCount
edges {
node {
... on Repository {
name
descriptionHTML
stargazers {
@katopz
katopz / crossbridge-flascc-obfuscation
Created August 3, 2014 16:46
Using CrossBridge/FlasCC for Code Obfuscation
// http://bruce-lab.blogspot.com/2014/08/using-crossbridgeflascc-for-code.html
// https://forums.adobe.com/message/5121420
// http://hecool108.blogspot.com/2013/08/hide-your-key-with-alchemyflascccrossbr.html
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "AS3/AS3.h"
void gk() __attribute__((used,
annotate("as3sig:public function ec(keystr:String):String"),
@katopz
katopz / ts-dl.sh
Created August 16, 2017 15:49
Download .ts video file by ffmpeg via .m3u8
# Install ffmpeg
brew install ffmpeg
# Download
ffmpeg -i https://foo.com/bar.m3u8 -c copy -bsf:a aac_adtstoasc output.mp4
@katopz
katopz / lazy-sd.md
Last active September 11, 2023 02:51
lazy download for sd

Get all d/l link as curl

Step

  1. open https://huggingface.co/lllyasviel/sd_control_collection/tree/main
  2. Run below code in browser console
let temp='';
document.querySelectorAll('a[href*="/resolve/"][href$=".safetensors"]').forEach(link => {
    const href = new URL(window.location.href).origin + link.getAttribute('href');
    temp+=`curl -OJL "${href}"\n`
@katopz
katopz / regular-expression.md
Last active December 7, 2022 04:29
handy regular expression

Find 3 space before any word.

^\s{3}(?=\w)

Find text between tag <h2>$1.1</h2>

const matched_values = text.match(/(">\$)(.*?)</gm)
const value = matched_values.length === 3 ? matched_values[2] : NaN
@katopz
katopz / change-window-title.js
Created November 16, 2022 15:46
change header title tab to some element every second
// https://www.investing.com/currencies/usd-thb
setInterval(()=>{window.document.title = document.querySelectorAll('span[data-test=instrument-price-last]')[0].innerText}, 1000);
@katopz
katopz / youtube-hd.js
Last active August 7, 2022 01:37
keep youtube at hi resolution
// https://gist.github.com/adisib/1e6b429b9bb630fceb170f3fa77c57a3
let ytPlayer = document.getElementById("movie_player") || document.getElementsByClassName("html5-video-player")[0];
let quality = ytPlayer.getAvailableQualityLevels()[0];
ytPlayer.stopVideo();
ytPlayer.setPlaybackQualityRange && ytPlayer.setPlaybackQualityRange(quality)
ytPlayer.setPlaybackQuality(quality);
let storedQuality = localStorage.getItem('yt-player-quality')
if (!storedQuality || storedQuality.indexOf(quality) === -1) {
let tc = Date.now(),
@katopz
katopz / GetRepositoryInfo.gql
Last active July 30, 2022 10:43
GraphQL Github Example : Get repository info.
// Try at : https://graphql-explorer.githubapp.com/
query {
repositoryOwner (login: "facebook") {
repositories {
totalCount
}
repository(name: "react") {
description
forks {
totalCount
@katopz
katopz / Install protobuf 3.8.0 on Ubuntu 18.04 x86_64
Last active July 27, 2022 08:17 — forked from ryujaehun/Install protobuf 3.6.1 on Ubuntu 16.04
Install protobuf 3.8.0 on Ubuntu 18.04 x86_64
#! /bin/bash
# Make sure you grab the latest version https://github.com/protocolbuffers/protobuf/releases/
curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v3.8.0/protoc-3.8.0-linux-x86_64.zip
# Unzip
unzip protoc-3.8.0-linux-x86_64.zip -d protoc3
# Move protoc to /usr/local/bin/
sudo mv protoc3/bin/* /usr/local/bin/