Skip to content

Instantly share code, notes, and snippets.

@atika
atika / iphone-simulator-app-folder.sh
Last active November 13, 2023 14:05
Open the iOS Simulator folder containing -user defaults- plists files for your Application
#!/bin/bash
appname="$1"
[ -z $appname ] && read -p "Application name : " appname
apppath=$(find ~/Library/Developer/CoreSimulator/Devices/ -name "$appname.app" -print -quit)
if [[ ! -z $apppath ]]; then
echo "Found path for $appname app"
echo -e "\033[1;30m$apppath\033[0m"
appbundle=$(osascript -e "id of app \"$apppath\"")
@atika
atika / pushover
Last active October 20, 2023 19:37
Send a pushover notification from Bash
#!/bin/bash
# ./pushover.sh -t "Pushover via Bash" -m "Pushover message sent with bash from $(hostname -f)" -p1 -s siren -u http://www.google.com -n "Google"
USER_TOKEN=YOUR_USER_TOKEN_HERE
# YOUR APPS TOKENS / UPPERCASE NAME WITH _TOKEN (usage: "-a monitor" uses MONITOR_TOKEN)
MONITOR_TOKEN=APP_TOKEN
BACKUP_TOKEN=APP_TOKEN
ALERT_TOKEN=APP_TOKEN
APP_LIST="monitor, backup, alert" # FOR USAGE
@atika
atika / README.md
Last active September 25, 2023 19:01
Text field and options dropdown for espanso (macOS only)

Simple prompt for espanso https://espanso.org/ on macOS

For the time being, espanso does not come with a graphical user interface, in the meanwhile you can use this workaround to prompt for text or select result in a list, on macOS.

Create a folder scripts in the espanso preferences folder and copy these files: /Users/<username>/Preferences/espanso/scripts/.

You can also copy Pashua app app into this folder.

espanso popup demo

@atika
atika / LaunchBar-Theme-Arguments.txt
Last active July 6, 2023 08:40
A non exhaustive list of LaunchBar theme arguments, extracted with grep from bundled themes, to make your custom themes.
defaultBoldFontName
defaultDimmedTextColor
defaultEmphasizedFontName
defaultFontName
defaultSelectedTextShadowColor@1x
defaultSelectedTextShadowColor@2x
defaultShadowOffset
defaultTextColor
defaultTextShadowColor
defaultTextShadowColor@2x
@atika
atika / SecondsToDaysHoursMinutesSeconds.swift
Created March 10, 2016 09:55
Convert seconds to days, hours, minutes, seconds in Swift
let seconds = 86400*4 + 3600*2 + 65
print(String((seconds / 86400)) + " days")
print(String((seconds % 86400) / 3600) + " hours")
print(String((seconds % 3600) / 60) + " minutes")
print(String((seconds % 3600) % 60) + " seconds")
@atika
atika / network_drive.list
Created March 26, 2017 15:50
Generate macOS apps from a list to mount your networks volumes
Awesome Volume;afp://macbookpro.local/MyHD
Home on MacBookPro;afp://macbookpro.local/macuser
DiskStation Video;smb://192.168.0.20/video
DiskStation Music;smb://192.168.0.20/music
@atika
atika / verify_programs.sh
Last active October 22, 2018 04:19
Verify if programs exits on system before executing a shell script
verify_programs() {
local programs="$1"
local ccyan="\\033[1;36m"
local cnormal="\\0033[0;39m"
abort=0
for p in $programs; do
type $p >/dev/null 2>&1 || { echo -e >&2 " ${ccyan}${p}${cnormal} required but it's not installed. Aborting."; abort=1; }
done
if [[ $abort -eq 1 ]]; then
exit 1;
@atika
atika / osx_set_app_category.sh
Last active September 29, 2018 03:40
Set the missing app category on OS X
#!/bin/bash
# Write category for an app
developer="public.app-category.developer-tools"
utilities="public.app-category.utilities"
productivity="public.app-category.productivity"
photography="public.app-category.photography"
video="public.app-category.video"
music="public.app-category.music"
@atika
atika / marked-markdown-preprocessor.rb
Last active September 29, 2018 03:40
Use Marked 2 markdown preprocessor functionality to rewrite each image URL to an absolute path on the system before displaying the preview.
#!/usr/bin/ruby
require 'pathname'
imgURLRegex = /^(!\[.*?\]\()([^\s\)]*)(\s*.*\))/
rootsPaths = [
'/Users/username/Path/To/hexo/source/',
'/Another/PathTo/Website/Directory/'
]
@atika
atika / CodeRunner-AngularJS-Exemple.js
Created March 10, 2016 10:58
CodeRunner compilation script to have Javascript, HTML and CSS in the same file
// The first script tag is optional if you start with javascript
//<script>
$(document).ready(function () {
$("body").append("<br>jQuery said AngularJS rocks!");
alert($(document).html());
});
angular.module('PricesApp', [])
.controller("PriceController", function () {