Skip to content

Instantly share code, notes, and snippets.

@janodev
janodev / subtitles.sh
Created February 20, 2023 22:09
Generating Spanish subtitles for a bunch of mp4 files on a folder (works for any language)
# install mac whisper
brew install python3 ffmpeg
pip install setuptools-rust
pip install -U openai-whisper
# create a script to extract audio and translate
for f in *.mp4; do FILE=`basename -s '.mp4' "$f"`; echo ffmpeg -i "\"$f\"" -vn -acodec copy "\"$FILE.aac\"" >> script.sh; done
for f in *.mp4; do FILE=`basename -s '.mp4' "$f"`; echo whisper "\"$FILE.aac\"" --language Spanish --model medium --task transcribe >> script.sh; done
# run the script. on M1 max this is several times slower than the audio being translated
@janodev
janodev / HideBackButtonTitleModifier.swift
Created December 25, 2022 18:29
Custom modifier to hide the back button title.
import SwiftUI
/// Custom modifier to hide the back button title.
/// From https://stackoverflow.com/a/62854805/412916
/// Usage: `.modifier(HideBackButtonTitleModifier())`
struct HideBackButtonTitleModifier: ViewModifier {
@Environment(\.presentationMode) var presentation
@ViewBuilder @MainActor func body(content: Content) -> some View {
content
@janodev
janodev / project.yml
Created May 16, 2021 22:15
Xcodegen project
name: myproject
options:
bundleIdPrefix: com.myproject
usesTabs: false
indentWidth: 4
tabWidth: 4
createIntermediateGroups: true
deploymentTarget:
iOS: "14.5"
@janodev
janodev / SomeView.swift
Created September 29, 2020 18:08
VFL example
import UIKit
final class SomeView: LayoutView
{
let view1 = UIView()
let view2 = UIView()
let view3 = UIView()
override func layout() {
super.layout()
@janodev
janodev / ioslocaleidentifiers.csv
Created November 8, 2019 00:44 — forked from jacobbubu/ioslocaleidentifiers.csv
iOS Locale Identifiers
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
mr Marathi
bs Bosnian
ee_TG Ewe (Togo)
ms Malay
kam_KE Kamba (Kenya)
mt Maltese
ha Hausa
es_HN Spanish (Honduras)
ml_IN Malayalam (India)
ro_MD Romanian (Moldova)
@janodev
janodev / AutoLayout.swift
Created April 30, 2019 14:05
Buttons with equal width using Visual Format Language
import UIKit
public extension UIView {
var autoLayout: AutoLayout {
return AutoLayout(self)
}
}
@janodev
janodev / karabiner.json
Created December 10, 2018 01:16
My Karabiner rules containing "WASD arrow Keys toggled by Capslock". See https://stackoverflow.com/a/53698322/412916
{
"global": {
"check_for_updates_on_startup": true,
"show_in_menu_bar": true,
"show_profile_name_in_menu_bar": false
},
"profiles": [
{
"complex_modifications": {
"parameters": {
@janodev
janodev / Makefile
Last active August 5, 2020 12:48
Securing Apache with client certificate authorisation
.DEFAULT_GOAL := hello
CA = ca
CA_NAME = Janodev CA
SERVER = jano
SERVER_DOMAIN = jano.dev
CLIENT = client
CLIENT_NAME = Janodev Notes User
SERVER_CONF = server.conf
CLIENT_CONF = client.conf
@janodev
janodev / idioms.swift
Last active June 29, 2018 16:17
initialising idioms
import UIKit
// this one doesn’t require a helper function
var label: UILabel = {
$0.backgroundColor = .blue
$0.text = "This is a playground"
$0.textColor = .white
$0.textAlignment = .center
return $0