Skip to content

Instantly share code, notes, and snippets.

View maciekish's full-sized avatar
💭
Flying airplanes

Maciej Swic maciekish

💭
Flying airplanes
View GitHub Profile
@maciekish
maciekish / alternative
Last active August 29, 2015 14:08
Aerowinx PSX Layout
[Aerowinx Precision Simulator - Layouts]
[Version 10.0.0]
[Layout 1]
title=Takeoff/Landing
screenX=0
screenY=22
screenW=1920
screenH=1000
dividerUpperX=0.7713542
@maciekish
maciekish / UIApplication+PhoneCapability.h
Last active March 25, 2016 12:26
UIApplication+PhoneCapability. Detects whether the device can actually place a phone call.
//
// UIApplication+PhoneCapability.h
//
// Copyright (c) 2014 Maciej Swic
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
tell application "Finder"
try
set appPath to (path to application "Evernote" as text)
on error
display dialog "Couldn't find Evernote. Is it installed?"
end try
try
set libPath to (path to library folder from user domain as text)
set newFolder to make new folder at libPath with properties {name:"PDF Services"}
@maciekish
maciekish / MKMapView+MoveLogo.h
Created July 8, 2013 08:45
This category allows you to move the MKMapView logo so that it remains visible if you put other stuff on the mapview. If the logo is hidden, the app won't pass the App Store review. Tested with iOS 5 through 7.
//
// MKMapView+MoveLogo.h
//
// Created by Maciej Swic on 2013-07-08.
// Released under the MIT license.
//
// This category allows you to move the MKMapView logo so that it remains visible if you
// put other stuff on the mapview. If the logo is hidden, the app won't pass the App Store
// review. Tested with iOS 5 through 7.
//
@maciekish
maciekish / NSObject+Association.h
Created December 3, 2013 16:49
Ever dreamed of adding "userInfo" to an UIAlertView? Now you can! This category allows you to assign any object to any object from iOS 3.1 and Mac OS 10.6 and up.
//
// NSObject+Association.h
//
// Created by Maciej Swic on 03/12/13.
// Released under the MIT license.
//
#import <Foundation/Foundation.h>
@interface NSObject (Association)
@maciekish
maciekish / plexupgrade.sh
Last active May 1, 2018 10:20
Qnap Plex Updater
pkg=${pkg/\/share/""}#!/bin/bash
# crontab -e as admin on Qnap.
# https://gist.github.com/maciekish/a6e3dc65523c2b25ff312b8f7689fd1c/
pkg=$(find /share/Media/plexmediaserver* | head -n 1)
localpkg=${pkg/\/share/""}
docker=$(which docker)
if [ -f "$pkg" ]
then
//
// NaturalMotion.swift
//
// Created by Maciej Swic on 2014-06-06.
// Released under the MIT license.
//
import UIKit
extension UIView {
@maciekish
maciekish / backup_sd.sh
Last active September 25, 2020 10:28
Backup Pi SD Card to Samba
#!/bin/bash
#Usage bash <(curl -Ls https://gist.githubusercontent.com/maciekish/dc1f9372916eacf06efe10aa6e9469cd/raw)
if [ `whoami` != 'root' ]
then
echo "You must be root to do this."
exit
fi
if [ -z "$1" ]
@maciekish
maciekish / RedirectWellKnownFolders.ps1
Created December 30, 2020 11:21
Redirect Well Known Folders
$username=( ( Get-WMIObject -class Win32_ComputerSystem | Select-Object -ExpandProperty username ) -split '\\' )[1]
$newPath = "D:\$($username)"
$key1 = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders"
$key2 = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders"
set-ItemProperty -path $key1 -name Desktop "$($newPath)\Desktop"
set-ItemProperty -path $key2 -name Desktop "$($newPath)\Desktop"
set-ItemProperty -path $key1 -name Pictures "$($newPath)\Pictures"
set-ItemProperty -path $key2 -name Pictures "$($newPath)\Pictures"
set-ItemProperty -path $key1 -name "My Pictures" "$($newPath)\Pictures"
set-ItemProperty -path $key2 -name "My Pictures" "$($newPath)\Pictures"
@maciekish
maciekish / NSHTTPCookieStorage+FreezeDry.h
Last active February 25, 2021 22:04
Persists UIWebView cookies to disk. To send the cookies with an initial NSURLRequest you must do the following after loading the cookies: NSMutableURLRequest* request = [NSMutableURLRequest requestWithURL:yourURL]; NSDictionary* headers = [NSHTTPCookie requestHeaderFieldsWithCookies:[[NSHTTPCookieStorage sharedHTTPCookieStorage] cookies]]; [requ…
//
// NSHTTPCookieStorage+FreezeDry.h
//
// Created by Maciej Swic on 19/08/13.
//  
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is