Skip to content

Instantly share code, notes, and snippets.

View DavideViolante's full-sized avatar
🏠
Working from home

Davide Violante DavideViolante

🏠
Working from home
View GitHub Profile
# Python script to convert Shift-JIS encoded .srt file to UTF-8 - Powered by ChatGPT
# The issue you're encountering is likely due to an encoding problem.
# The text in your subtitle file seems to be encoded in Shift-JIS, a common encoding for Japanese text, but it is being interpreted incorrectly, probably as Latin-1 or another encoding.
# To fix this, you need to convert the subtitle file from Shift-JIS to UTF-8, which is the standard encoding for most modern software and supports a wide range of characters, including Japanese.
# Uou can use a simple Python script to convert the file from Shift-JIS to UTF-8. Here is a script that will do that for you:
input_file = 'input.srt' # Replace with your actual file name
output_file = 'output_utf8.srt' # Output file name
with open(input_file, 'r', encoding='shift_jis') as file:
// ==UserScript==
// @name HN target blank
// @namespace http://tampermonkey.net/
// @version 0.3
// @description Open Hacker News links in a new tab
// @author Davide Violante
// @match https://news.ycombinator.com/*
// @grant none
// ==/UserScript==
@DavideViolante
DavideViolante / .bashrc
Last active June 10, 2024 15:20
Show current git branch in Ubuntu bash
# Add these lines to your .bashrc file located in ~/
# Show date in terminal
function show_date() {
local current_time="[$(date '+%T')]"
local green='\[\033[01;32m\]'
local blue='\[\033[01;34m\]'
local reset='\[\033[0m\]'
PS1="$current_time ${green}\u${reset}${green}@${reset}${green}\h${reset}:${blue}\w${reset}\$ "
}