Skip to content

Instantly share code, notes, and snippets.

View mfaani's full-sized avatar

Mohammad Faani mfaani

View GitHub Profile
@mfaani
mfaani / stdin_vs_stdout.md
Last active September 16, 2022 18:20
stdin vs stdout

Great video on stdin vs stdout: https://www.youtube.com/watch?v=OsErpB0-mWY

stdin

As a standard your input usually comes from the keyboard. Ex cat file.txt. <- here you're passing file.txt as a parameter.

However you can do cat < $file_name i.e. make the input to the cat command a variable.

Both cat file.txt & cat < file.txt achieve the same, but through different mechanics. < is passing something as an input.

I suppose it's because the cat command has abilities to handle file names as arguments and through stdin

@digiter
digiter / ios_code_signing_examples.sh
Last active September 20, 2023 15:41 — forked from chance909/iOS Codesigning command line commands
iOS code signing commands
//Tutorial https://www.objc.io/issues/17-security/inside-code-signing/
//Print which signing certificates are on computer
security find-identity -v -p codesigning
//Print what was used to codesign an app
codesign -vv -d Example.app
//Print what entitlements are enabled for app
codesign -d --entitlements - Example.app
@damian-rzeszot
damian-rzeszot / override_app_extensions.sh
Last active November 9, 2024 01:13
override_app_extensions.sh
alias plistbuddy=/usr/libexec/PlistBuddy
alias codesign=/usr/bin/codesign
#
# Bundle identifier
#
set_plist_bundle_identifier() {
local bundle_identifier="$1"
@IsaacXen
IsaacXen / README.md
Last active November 21, 2024 15:00
(Almost) Every WWDC videos download links for aria2c.
@mgrider
mgrider / vim-swift-setup.sh
Last active March 22, 2024 01:55 — forked from jlehikoinen/setup.sh
Swift syntax highlighting for Vim
# Swift syntax highlighting for Vim
# Original Source: http://wingsquare.com/blog/swift-script-syntax-highlighting-and-indentation-for-vim-text-editor/
# Another helpful article: https://billyto.github.io/blog/swift-syntax-vim
# More about Vim packages: http://vimcasts.org/episodes/packages/
echo "--- creating ~/.vim/pack/bundle/start dir.."
mkdir -p ~/.vim/pack/bundle/start
echo "--- Cloning Apple's Swift repo.."
@tclementdev
tclementdev / libdispatch-efficiency-tips.md
Last active November 19, 2024 05:05
Making efficient use of the libdispatch (GCD)

libdispatch efficiency tips

The libdispatch is one of the most misused API due to the way it was presented to us when it was introduced and for many years after that, and due to the confusing documentation and API. This page is a compilation of important things to know if you're going to use this library. Many references are available at the end of this document pointing to comments from Apple's very own libdispatch maintainer (Pierre Habouzit).

My take-aways are:

  • You should create very few, long-lived, well-defined queues. These queues should be seen as execution contexts in your program (gui, background work, ...) that benefit from executing in parallel. An important thing to note is that if these queues are all active at once, you will get as many threads running. In most apps, you probably do not need to create more than 3 or 4 queues.

  • Go serial first, and as you find performance bottle necks, measure why, and if concurrency helps, apply with care, always validating under system pressure. Reuse

@wanyakun
wanyakun / LLDB Debugger commands.txt
Created November 8, 2016 03:03
LLDB Debugger commands
Debugger commands:
apropos -- List debugger commands related to a word or subject.
breakpoint -- Commands for operating on breakpoints (see 'help b' for
shorthand.)
bugreport -- Commands for creating domain-specific bug reports.
command -- Commands for managing custom LLDB commands.
disassemble -- Disassemble specified instructions in the current
target. Defaults to the current function for the
current thread and stack frame.
// AFNetworking
[[AFHTTPSessionManager manager] GET:@"http://httpbin.org/ip" parameters:nil success:^(NSURLSessionDataTask *task, id JSON) {
NSLog(@"IP Address: %@", JSON[@"origin"]);
} failure:^(NSURLSessionDataTask *task, NSError *error) {
NSLog(@"Error: %@", error);
}];
// NSURLSession
NSURL *URL = [NSURL URLWithString:@"http://httpbin.org/ip"];
@larryaasen
larryaasen / gist:5035313
Created February 26, 2013 02:29
Using the Xcodeproj Ruby Gem - open exising Xcode project, add a file to the project in the main group, add the file to the main target, and save the Xcode project file.
# Open the existing Xcode project
project_file = product_name + '.xcodeproj'
project = Xcodeproj::Project.new(project_file)
# Add a file to the project in the main group
file_name = 'Message.m'
group_name = product_name
file = project.new_file(file_name, group_name)
# Add the file to the main target