Skip to content

Instantly share code, notes, and snippets.

View Phate334's full-sized avatar
🐱

Phate Phate334

🐱
View GitHub Profile
@Phate334
Phate334 / backup_docker_compose.sh
Last active November 5, 2024 02:08
Simple script to backup volumes in docker compose env.
#!/bin/bash
# Function to get Docker API version
get_docker_api_version() {
docker version --format '{{.Server.APIVersion}}'
}
# Function to get volume paths from docker-compose and backup
backup_volumes() {
# Get the API version
import os
import sys
import uuid
import time
import math
import multiprocessing
from abc import ABC, abstractmethod
from typing import (
List,
Optional,
@Phate334
Phate334 / Translated-Whisper.md
Last active August 5, 2023 08:25
Faster Whisper + Google translate

Install

!pip install faster-whisper
!pip install googletrans==3.1.0a0
!pip install pysubs2
00033caf-494f-4721-99d9-cd109aa152d4.jpg
000ba543-20b2-452e-abe3-b4ce42cfe91b.jpg
001729ab-d648-4e67-aeda-4757131f19b3.jpg
00182245-a6d6-43a4-8eb1-0ca0ba3015c5.jpg
002a3cab-b0b4-4fd2-b602-10c60c8d9255.jpg
002b037f-ecca-4a46-b424-7560ca4ecf1e.jpg
002b7873-92cd-472c-a92b-ebba91502fdb.jpg
0036b7d7-9749-4cff-85c2-3bb37bb28df0.jpg
003807b1-b06d-4105-b959-4e172eb20f56.jpg
@Phate334
Phate334 / slim-python.omp.json
Created January 31, 2023 08:03
oh-my-posh python style
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"blocks": [
{
"alignment": "left",
"segments": [
{
"background": "#2f2f2f",
"foreground": "#26C6DA",
"leading_diamond": "\ue0c7\u2593",
@Phate334
Phate334 / docker-compose.yml
Last active March 2, 2024 01:33
JanusGraph and OpenSearch
version: "3"
services:
janusgraph:
image: janusgraph/janusgraph:0.6.2
container_name: jce-janusgraph
env_file:
- janusgraph.env
ports:
- "8182:8182"
@Phate334
Phate334 / fb-copy.js
Last active January 30, 2022 10:12
bookmarklet for removing Click identifier
javascript: (() => {
const blocked = new Set(['fbclid', 'utm_source', 'utm_medium', 'utm_campaign', 'ref_src', 'ref_url']);
let url = new URL(document.URL);
let params = new URLSearchParams(url.searchParams);
for (let key of params.keys()) {
if (blocked.has(key)) {
url.searchParams.delete(key);
}
}
let result = `${url.origin}${url.pathname}${url.searchParams.toString() ? '?' + url.searchParams.toString() : ''}${url.hash}`;
@Phate334
Phate334 / youtube-copy.js
Last active January 23, 2022 16:15
bookmarklet
javascript: (() => {
const vid = new URL(document.URL).searchParams.get('v');
navigator.clipboard.writeText("https://youtu.be/" + vid);
})();
@Phate334
Phate334 / parameter.py
Last active December 11, 2020 17:03
pydantic and decorator
from pydantic import BaseModel
def func_helper(parameter_type, return_type=None):
def decorator(function):
def wrapper(*args, **kwargs):
result = function(parameter_type(**kwargs))
return return_type(**result) if return_type else result
return wrapper
@Phate334
Phate334 / fb-creatorstudio-player.js
Last active June 10, 2019 16:29
在 Facebook Creator Studio 音樂庫中自動切換下一首歌曲。https://www.facebook.com/creatorstudio/
// Auto switch to next one when end of a song.
// start playing a song then paste this code.
(function() {
function getElementByXpath(path) {
return document.evaluate(
path,
document,
null,
XPathResult.FIRST_ORDERED_NODE_TYPE,
null