Skip to content

Instantly share code, notes, and snippets.

@jason19970210
jason19970210 / photo_rename.py
Last active June 8, 2024 03:54
Photo Rename with datetime ft. timezone
# -*- coding: utf-8 -*-
'''
$ adb devices
$ adb push /Users/macbook/.../* /sdcard/DCIM/Camera/
$ adb push /Users/macbook/.../*.JPG /sdcard/DCIM/Camera/
'''
'''
@jason19970210
jason19970210 / bookmark.js
Created December 12, 2023 07:50
Freedium Bookmarlet Script
// Just create a new bookmark and copy/paste the following script into the URL section
// Usage: Once getting paid wall in medium, just click the bookemark to redirect the page
javascript: (()=>{ let loc = window.location.href; let new_loc = "https://freedium.cfd/" + loc; window.location = new_loc;})();
@jason19970210
jason19970210 / model_permission.go
Last active November 23, 2023 06:39
Permission struct for OMC access control
package model
import (
log "omc-backend/pkg/logging"
"omc-backend/pkg/role"
)
type Permissions struct {
Create bool `json:"create"`
Read bool `json:"read"`
@jason19970210
jason19970210 / tm_hide_aws_regions.js
Created November 1, 2023 08:03 — forked from wmathes/tm_hide_aws_regions.js
TamperMonkey: Hide AWS regions from dropdown menu.
// ==UserScript==
// @name ScreenCloud AWS: region dropdown cleanup
// @namespace http://tampermonkey.net/
// @version 0.1
// @author wolf@screencloud.io
// @include https://*.console.aws.amazon.com/*
// @grant none
// ==/UserScript==
(function() {
@jason19970210
jason19970210 / test_epoch1.py
Last active October 4, 2023 06:17
Test timestamp & datetime convert with Polars
import polars as pl
df = pl.DataFrame({
"epoch_seconds": [1648457740, 1648457740 + 10]
})
# print(df)
df = df.with_columns(
pl.from_epoch("epoch_seconds", time_unit="s")
@jason19970210
jason19970210 / README.md
Last active September 10, 2023 02:16
[Solved] Golang test with cgo for shared object (.so) usage

Solved the problem with Attempt 2 with export LD_LIBRARY_PATH

Environment

## On-Premise
OS: Ubuntu 22.04.2
Golang Ver.: 1.21.0
GCC Ver.: 11.4.0

## Docker
@jason19970210
jason19970210 / test-cv2-output-video.py
Created May 26, 2023 07:06
Output Video with Frames with cv2 & Numpy
import cv2
import numpy as np
# Set frame size
frame_width = 1920
frame_height = 1080
# Create a VideoWriter object
video_writer = cv2.VideoWriter('output_video.mp4', cv2.VideoWriter_fourcc(*'mp4v'), 30, (frame_width, frame_height))
@jason19970210
jason19970210 / main.dart
Last active May 19, 2023 05:47
Flutter App Lifecycle Test
// Date: 2023/05/19
// From anomoly user named SI from Line OpenChat Flutter-Disgussion-Group
// For Education & Learning Purpose
void main() {
runApp(MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@jason19970210
jason19970210 / apscheduler-test.py
Created April 14, 2023 16:48
[test] a fastapi backend with apscheduler
from datetime import datetime
from fastapi import FastAPI
from fastapi.responses import JSONResponse
import uvicorn
from apscheduler.schedulers.background import BackgroundScheduler
## Init
app = FastAPI()
scheduler = BackgroundScheduler()
#!/usr/bin/python
# -*- coding:utf-8 -*-
import os, sys, logging, time, datetime, signal
from datetime import datetime
import config
import utils
import threading
from flask import Flask, jsonify, request
from PIL import Image, ImageDraw, ImageFont