Skip to content

Instantly share code, notes, and snippets.

@aadnk
aadnk / YouTube Comment.md
Last active November 11, 2023 10:57
Comment from 2022-06-20 on The REASON Google Translate FAILS at Japanese from 2022

Comment

Looks like Google translate has improved since 2020 - it's no longer inventing puppy ramen out of nowhere, and it's using more correct pronouns. Or someone at Google was embarrassed after watching this video, and made the necessary bug fixes. Still, I'd give DeepL a slight edge when compared to Google Translate.

I also tried using GPT-3 using the prompt "Translate the following restaurant review: Japanese: [TEXT] English: ", and it's arguably even better than DeepL:

  1. 隣の駐車場に停めていたらここのおばさんらしき人に何か言われた何を言っているのかは分からなかったが怒った口調だった。とても不愉快。 Google Translate: When I was parked in the parking lot next door, I didn't know what the aunt-like person was saying, but I was angry. She is very unpleasant. DeepL:
@aadnk
aadnk / Tweet Translation.md
Created November 11, 2023 10:33
Translating Japanese Tweets (X-es?) with ChatGPT

Translation of a tweet

I came upon this on Twitter/X, and I couldn't make heads or tails of it: 病院で診察待ちしてたら車当てられてさ 就活中の大学生と思われるカップルで2人ともスーツ着てて初心者マークだったから

ちゃんと申告したのえらいなぁ
事故したのショックだろうなぁ
トラウマにならなきゃいいけどなぁ
彼氏あとでフォローしてあげなよー
@aadnk
aadnk / GPT-4 comparisions.md
Last active November 8, 2023 16:42
Various versions of GPT-4 answer to "How can I check if there are non-None values in a list?"

Prompt

User: How can I check if there are non-None values in a list?

GPT-4

Here, GPT-4-1106-preview is the latest version released on 2023-11-06, then GPT-4-0614 on 2023-06-14, and finally GPT-4-0314 originally released on 2023-03-14.

GPT-4-1106-preview

@aadnk
aadnk / injectApi.py
Last active March 6, 2024 06:20
Inject a REST API into Streamlit by injecting into Tornado
import logging
import threading
from typing import Any, Dict, Iterable, Optional, Union
from tornado.routing import Rule, Matcher
_global_tornado_hook = None
_global_hook_lock = threading.RLock()
class CustomRule:
def __init__(self, path_pattern: Union[str, Matcher], handler_class: Any,
@aadnk
aadnk / .env
Last active September 6, 2020 22:21
Docker-compose script for setting up Guacamole, with support for file copying
POSTGRES_USER=dbuser
POSTGRES_PASSWORD=changeme
POSTGRES_ADMIN_PASSWORD=changeme
@aadnk
aadnk / SquareSpiral.java
Last active January 25, 2019 04:41
Trapped Knight Problem
import java.util.*;
public class SquareSpiral {
// Starting point of the spiral
private final int startX;
private final int startY;
private SquareSpiral(int startX, int startY) {
this.startX = startX;
this.startY = startY;
import java.util.*;
public class TimeMap<TKey extends Comparable<TKey>, TValue> {
public static void main(String[] args) {
TimeMap<Integer, Integer> map = new TimeMap<>();
map.set(1, 1, 0);
map.set(1, 2, 2);
map.remove(1, 3);
map.set(2, 100, 0);
@aadnk
aadnk / PatternMatchingTest.java
Last active August 3, 2017 17:16
Test of the pattern matching pseudo code in "Pattern Matching with Brian Goetz @briangoetz"
package com.comphenix.test;
import java.util.Objects;
public class PatternMatchingTest {
public static void main(String[] args) throws Exception {
AddNode zeroPlusOne = new AddNode(IntNode.ZERO, IntNode.ONE);
AddNode onePlusOne = new AddNode(IntNode.ONE, IntNode.ONE);
System.out.println("Testing our proposed fix: ");
@aadnk
aadnk / gist:4e2064d17f54970c1d4c
Created May 14, 2015 23:33
Amaz Boombot Simulation
package com.comphenix.testing;
import java.util.Random;
public class Test {
private static final int SIMULATION_COUNT = 1_000_000_000;
public static void main(String[] args) throws Exception {
Random rnd = new Random();
int amazWin = 0;
@aadnk
aadnk / Test.java
Created December 19, 2014 17:30
Test of MagicAccessorImpl to speed up access of private packet fields
package com.comphenix.example;
import java.util.concurrent.ConcurrentMap;
import org.bukkit.plugin.java.JavaPlugin;
import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.events.PacketContainer;
import com.comphenix.protocol.injector.StructureCache;
import com.comphenix.protocol.reflect.FieldUtils;