Skip to content

Instantly share code, notes, and snippets.

@akfreas
akfreas / find_replace.sh
Created January 24, 2024 16:55
Find and replace filenames and references
'
# File Replacement and Backup Script
This script is designed to search through files within a specified directory, replace occurrences of a search string with a replacement string, and backup the original files.
It will rename every instance of that string, found not only in the files themselves, but also in the filename and directory name.
## Features
- Searches for files containing a specific string.
- Replaces the found string with a new string.
@akfreas
akfreas / translate_strings.py
Created January 18, 2024 10:49
Auto Translate iOS Strings
#!/usr/bin/env python3
import argparse
import os
import openai
from pprint import pprint
import os
from openai import OpenAI
from tqdm import tqdm
{
"expose.expose": {
"@xlink.href": "https://rest.sandbox-immobilienscout24.de/restapi/api/search/v1.0/expose/314747248",
"@id": "314747248",
"@modification": "2019-11-27T13:26:20.793Z",
"@creation": "2019-03-19T12:57:04.000+01:00",
"@publishDate": "2019-03-19T12:57:04.000+01:00",
"@contactFormType": "EMAIL",
"realEstate": {
"@xsi.type": "expose:ApartmentRent",
@akfreas
akfreas / CounterViewController.swift
Created April 9, 2019 06:48
CounterViewController.swift
public class CounterViewController: UIViewController {
@IBOutlet internal var counterButton: UIButton?
@IBOutlet internal var counterLabel: UILabel?
....
@akfreas
akfreas / AppDelegate.swift
Created April 8, 2019 21:49
SimpleCounter AppDelegate
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow? = UIWindow(frame: UIScreen.main.bounds)
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
window?.rootViewController = CounterViewController()
window?.makeKeyAndVisible()
def feed_pods
pod 'SVProgressHUD', SVProgressHUDVersion
pod 'RxSwift', RxSwiftVersion
pod 'RxCocoa', RxSwiftVersion
pod 'Shimmer', ShimmerVersion
end
def extract_pngs_from_ttf():
with open('/System/Library/Fonts/Apple Color Emoji.ttc', 'rb') as ttf:
pos = 0
png_seq = '\x89\x50\x4E\x47\x0D\x0A\x1A\x0A'
end_seq = '\x49\x45\x4E\x44'
byte = ttf.read(8)
current_png = None
xcodebuild -workspace ImmoScoutWohnen.xcworkspace -scheme ImmoScout clean build OTHER_SWIFT_FLAGS="-Xfrontend -debug-time-function-bodies" 2> warnings.txt | gawk '{ print strftime("%s: "), $0; fflush(); }' | tee build_output.txt
@akfreas
akfreas / dhis.conf
Created May 6, 2017 13:51
dhis.conf
# Hibernate SQL dialect
connection.dialect = org.hibernate.dialect.PostgreSQLDialect
# JDBC driver class
connection.driver_class = org.postgresql.Driver
# JDBC driver connection URL
connection.url = jdbc:postgresql://${RDS_HOSTNAME}:${RDS_PORT}/${RDS_DB_NAME}
# Database username
BACKUP_DIR='_backup';
FILE_LIST=`find . -type f -not -path "*$BACKUP_DIR*"`
mkdir -pv $BACKUP_DIR;
while IFS= read -r line
do
if [[ $line == *"$1"* ]]; then
newfile=`echo $line | sed "s%$1%$2%g"`;
mkdir -pv "`dirname "$newfile"`";
echo "Copying $line to $newfile";
cp "$line" "$newfile" 2> /dev/null;