Skip to content

Instantly share code, notes, and snippets.

View hrchu's full-sized avatar
:octocat:
Have an Octotastic day!

petertc hrchu

:octocat:
Have an Octotastic day!
View GitHub Profile
[
{
"session_id": "E9UKFQ",
"room": "TR511",
"start_time": "2025-08-09T14:00:00+08:00",
"end_time": "2025-08-09T14:30:00+08:00",
"session_name": "AI may not imitate Handmake - why sake/wine/craft beer are not make by 'Robots'",
"speaker_names": [
"Masafumi Ohta"
]
@hrchu
hrchu / auto_translate_submissions.py
Created July 18, 2025 07:48
COSCUP 2025 pretalx submission translate
"""
Script to automatically translate and fill missing translated titles and
abstracts for non-English submissions using DeepL API.
Flow:
1. Iterate all submissions or a specific submission
2. Filter those where language is not English and translated title/abstract
is empty
3. Read original title/abstract, translate using DeepL, and fill the answers
4. Update submissions with the translations
@hrchu
hrchu / dazzcam.md
Last active October 10, 2024 03:22
Dazz Cam cameras description

Here’s the classification based on your categories, with highlights for each camera model:

VINTAGE 135 (35mm film cameras)

  1. 135 NE35mm Slide Film
    Highlight: Film designed to produce high-quality slides for projection or scanning.

  2. 135 SRLomo Sprocket Rocket
    Highlight: A panoramic camera that exposes sprocket holes on the film, creating unique images.

  3. Classic USLR, possibly Leica R3

@hrchu
hrchu / tx_sales_chart.py
Created August 6, 2024 07:38
pycon tw 2024 tx sales trend
import matplotlib.pyplot as plt
from statsmodels.tsa.holtwinters import ExponentialSmoothing
import numpy as np
# 1. 數據準備
# 2024年銷售數據(從第8天開始)
sales_data_2024 = [34, 66, 68, 70, 73, 75, 79, 83, 88, 92, 94, 98, 102, 109, 112, 113, 117, 118, 120, 121, 122, 123, 128, 136, 140]
sales_data_2024.extend([142, 146, 149, 154, 155, 161, 164, 167, 171, 175, 180, 183, 187, 202, 209, 214, 219, 221, 221]) # Aug 8 added
# 2023年銷售數據
@hrchu
hrchu / S3OutpostsBucket.java
Last active May 31, 2024 02:00
Example code of operating S3 on Outposts with AWS Java SDK v2. Checkout AWS offical document for using v1: https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3OutpostsCreateAccessPoint.html
import software.amazon.awssdk.auth.credentials.ProfileCredentialsProvider;
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.s3control.S3ControlClient;
import software.amazon.awssdk.services.s3control.model.*;
import java.util.stream.Collectors;
public class S3OutpostsBucket {
public static void main(String[] args) {
// Enable debug-level logging for the AWS Java SDK v2
@hrchu
hrchu / prompt_generate_500_tokens
Created May 15, 2024 03:19
prompts to benchmark GPT token per second
generate 500 token story
@hrchu
hrchu / disable_proxy.sh
Created April 26, 2024 05:01
ubuntu HTTP proxy switch
#!/bin/bash
# Remove proxy settings for various protocols
unset http_proxy
unset https_proxy
unset ftp_proxy
unset rsync_proxy
# Remove proxy for apt (if exists)
sudo rm -f /etc/apt/apt.conf.d/99proxy
@hrchu
hrchu / gist:b53e12389d2e4b0d01ddd29fe4a4d9eb
Last active November 1, 2023 06:16
play solid_oidc_client
In [2]: from solid_oidc_client import SolidOidcClient, MemStore
...: solid_oidc_client = SolidOidcClient(storage=MemStore())
...: import requests
In [4]: issuer = 'https://login.inrupt.com/'
...: redirect_url = 'http://localhost:3333/oauth/callback'
...: solid_oidc_client.register_client(issuer, [redirect_url])
In [5]: login_url = solid_oidc_client.create_login_uri('/', redirect_url)
...: print(login_url)
@hrchu
hrchu / PlayPath.java
Created October 22, 2022 14:57
Relative path handling in Java
package org.example;
import java.io.File;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Path;
public class PlayPath {
@hrchu
hrchu / TestGson.java
Last active September 13, 2022 13:17
Convert Json from/to object/tree/inputstream/reader/file with Gson in Java
import com.google.gson.Gson;
import com.google.gson.JsonElement;
import java.io.ByteArrayInputStream;
import java.io.InputStreamReader;
import org.junit.jupiter.api.Test;
/**
* Convert Json from/to object/tree/inputstream/reader/file with Gson in Java
*
* ref https://www.javadoc.io/doc/com.google.code.gson/gson/2.9.0/com.google.gson/com/google/gson/Gson.html