View fix-tm-backup.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
BACKUP_PATH=$1 | |
if [ -z "$BACKUP_PATH" ]; then | |
echo "Please provide path to Time Machine backup bundle." | |
exit 1 | |
fi | |
echo "More info at https://jd-powered.net/notes/fixing-your-time-machine-backup/" |
View ufw-delete-rules.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e | |
PATTERN=$1 | |
COUNT=0 | |
for RULE in $(sudo ufw status numbered | (grep $PATTERN | awk -F"[][]" '{print $2}')); do | |
sudo ufw --force delete $((RULE-COUNT)) | |
((COUNT=COUNT+1)) | |
done |
View macos_dd_obs_test.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Since we're dealing with dd, abort if any errors occur | |
set -e | |
TEST_FILE=${1:-dd_obs_testfile} | |
TEST_FILE_EXISTS=0 | |
if [ -e "$TEST_FILE" ]; then TEST_FILE_EXISTS=1; fi | |
TEST_FILE_SIZE=134217728 |
View macos_dd_ibs_test.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Since we're dealing with dd, abort if any errors occur | |
set -e | |
TEST_FILE=${1:-dd_ibs_testfile} | |
if [ -e "$TEST_FILE" ]; then TEST_FILE_EXISTS=$?; fi | |
TEST_FILE_SIZE=134217728 | |
# Exit if file exists |
View log_out.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View ScaleUIImage.playground
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import XCPlayground | |
enum UIImageAlignment { | |
case Center, Left, Top, Right, Bottom, TopLeft, BottomRight, BottomLeft, TopRight | |
} | |
enum UIImageScaleMode { | |
case Fill, | |
AspectFill, |
View semaphore.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
func testFunction(completion: () -> ()) { | |
dispatch_async(dispatch_get_main_queue()) { | |
completion() | |
} | |
} | |
func testSemaphore() { | |
let semaphore = dispatch_semaphore_create(0) |
View allOf-test.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"swagger": "2.0", | |
"info": { | |
"version": "1.0.0", | |
"title": "API", | |
"description": "API" | |
}, | |
"schemes": [ | |
"http" | |
], |
View photoshop-export-layers-android.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#target photoshop | |
function main(){ | |
if(!documents.length) | |
return; | |
// suppress all dialogs | |
app.displayDialogs = DialogModes.NO; | |
var mainDoc = app.activeDocument; | |
var docFullName = mainDoc.fullName; |
View photoshop-export-layers-iphone.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#target photoshop | |
function main(){ | |
function scanLayers(el, path, isRetina) { | |
new Folder(path).create(); | |
// process layer sets (groups) | |
for(var i = 0; i < el.layerSets.length; i++){ | |
var layer = el.layerSets[i]; | |
if (!layer.visible) |
NewerOlder