Skip to content

Instantly share code, notes, and snippets.

@dongmai
dongmai / Ansible Let's Encrypt Nginx setup
Created August 14, 2023 09:02 — forked from mattiaslundberg/Ansible Let's Encrypt Nginx setup
Let's Encrypt Nginx setup with Ansible
Ansible playbook to setup HTTPS using Let's encrypt on nginx.
The Ansible playbook installs everything needed to serve static files from a nginx server over HTTPS.
The server pass A rating on [SSL Labs](https://www.ssllabs.com/).
To use:
1. Install [Ansible](https://www.ansible.com/)
2. Setup an Ubuntu 16.04 server accessible over ssh
3. Create `/etc/ansible/hosts` according to template below and change example.com to your domain
4. Copy the rest of the files to an empty directory (`playbook.yml` in the root of that folder and the rest in the `templates` subfolder)
@dongmai
dongmai / android-update-config.rb
Created January 5, 2022 10:42
Android update config with fastlane
# Update social info
socialInfo = config["socials"]
fbId = ""
gmapId = ""
if socialInfo.kind_of?(Array)
socialInfo.each do |item|
if item["type"] == "google"
gmapId = item["gmap_id"]
end
@dongmai
dongmai / ios-plist-adjust.rb
Created January 5, 2022 10:41
iOS update plist file with fastlane
# Update social info
socialInfo = config["socials"]
fbId = ""
schemes = []
if socialInfo.kind_of?(Array)
socialInfo.each do |item|
if item["type"] == "google"
schemes << {
"role" => "Editor",
@dongmai
dongmai / update-localizations.rb
Created January 5, 2022 10:39
iOS update localization files with fastlane
localization = config["localization"]
localization.each do |loc|
if loc["iso"] == "en"
replaceFile(
"#{placeHolderPath}/Localized/en.lproj/Localizable.strings",
Base64.decode64(loc["content"])
)
end
if loc["iso"] == "ja"
@dongmai
dongmai / replace-file.rb
Created January 5, 2022 10:38
Replace file with fastlane
unless dashIconDownloadUrl.empty?
tempfile = Down.download(dashIconDownloadUrl)
replaceFile(
"#{placeHolderPath}/Placeholder.xcassets/dash-logo.imageset/dash-logo.png",
tempfile.path
)
end
@dongmai
dongmai / android-change-appicon.rb
Created January 5, 2022 10:37
Android change app icon with fastlane
unless iconDownloadUrl.empty?
tempfile = Down.download(iconDownloadUrl)
android_appicon(
appicon_image_file: tempfile.path,
appicon_icon_types: [:launcher, :notification],
appicon_path: Dir.pwd + "#{placeHolderPath}/res/mipmap",
generate_rounded: true,
)
end
@dongmai
dongmai / ios-change-appicon.rb
Created January 5, 2022 10:36
iOS change app icon with fastlane
unless iconDownloadUrl.empty?
tempfile = Down.download(iconDownloadUrl)
appicon(
appicon_image_file: tempfile.path,
appicon_devices: [:iphone, :ios_marketing],
appicon_path: Dir.pwd + "#{placeHolderPath}/Placeholder.xcassets",
remove_alpha: true,
)
end
@dongmai
dongmai / change-appid.rb
Created January 5, 2022 10:35
Android change app id with fastlane
gradeFilePath = Dir.pwd + "/../app/build.gradle"
changeAppId(bundleId)
@dongmai
dongmai / change-android-app-name.rb
Created January 5, 2022 10:34
Change android app name with fastlane
android_change_string_app_name(
newName: appName,
stringsFile: filePath,
)
@dongmai
dongmai / update-info.rb
Created January 5, 2022 10:31
Update info plist with fastlane
update_info_plist(
plist_path: "{your_plist_path}",
display_name: appName,
app_identifier: bundleId,
)