Skip to content

Instantly share code, notes, and snippets.

View tomasharkema's full-sized avatar

Tomas Harkema tomasharkema

View GitHub Profile
@krzys-h
krzys-h / journalctl_to_plymouth.sh
Created January 15, 2021 00:09
Display systemd init messages on the plymouth boot screen
#!/bin/sh
journalctl --quiet -f -n0 --system -t systemd -o cat | while read -r line; do
plymouth display-message --text="$line"
if [ $? -ne 0 ]; then
break
fi
done
echo "Plymouth died, exiting..."
@mzaks
mzaks / debounce.swift
Last active March 4, 2019 09:47
Swift debounce function based GCD
import Foundation
/**
Creates and returns a new debounced version of the passed block which will postpone its execution until after wait seconds have elapsed since the last time it was invoked.
It is like a bouncer at a discotheque. He will act only after you shut up for some time.
This technique is important if you have action wich should fire on update, however the updates are to frequent.
Inspired by debounce function from underscore.js ( http://underscorejs.org/#debounce )
*/
public func dispatch_debounce_block(wait : NSTimeInterval, queue : dispatch_queue_t = dispatch_get_main_queue(), block : dispatch_block_t) -> dispatch_block_t {
@mac-cain13
mac-cain13 / Readme.md
Last active August 29, 2015 14:11
Automatically copy all PNG assets to the correct Android drawable folder when exporting from for example Sketch.

Android assets folder action

Automatically copy all PNG assets to the correct Android drawable folder. Very helpful when exporting assets with @?x-suffix from, for example, Sketch and putting them into the correct folder without human interaction.

Setup

  1. Copy the AppleScript file to ~/Library/Workflows/Applications/Folder Actions
  2. Create a export folder where you'll put all exported PNGs
  3. Right click the folder, choose configure folder actions, check the "Enable folder actions" checkbox and attach the android_assets.scpt to your folder
  4. Open the terminal and create a symbolic link by typing ln -s /path/to/android-project/app/src/main/res /path/to/export-folder-you-just-created