root@laptop [02:00:10] [~/Documents/pentest/cours]
-> # ls -alh opti printf-libc
-rwxr-xr-x 1 root root 1,5K juin 12 14:00 opti
-rwxr-xr-x 1 root root 726K juin 12 14:00 printf-libc
root@laptop [02:00:26] [~/Documents/pentest/cours]
-> # ./opti arg1 arg2 arg3
./opti
arg1
import UIKit | |
@UIApplicationMain | |
class AppDelegate: UIResponder, UIApplicationDelegate { | |
var window: UIWindow? | |
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { | |
let window = UIWindow(frame: UIScreen.main.bounds) |
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
#!/bin/bash | |
set -e | |
CONTENTS=$(tesseract -c language_model_penalty_non_dict_word=0.8 --tessdata-dir /usr/local/share/tessdata/ "$1" stdout -l eng | xml esc) | |
hex=$((cat <<EOF | |
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> |
{ | |
"๐":"diamond | engagement ring | diamond ring | diamond rings | diamonds | engagement rings", | |
"๐":"blood type AB", | |
"โฃ":"heart", | |
"๐ฑ๐จ":"Saint Lucia | Saint Lucian flag", | |
"๐ฎ๐ช":"Ireland | Irish flag", | |
"๐จ๐ฎ":"Cรดte dโIvoire | Ivory Coast | Ivorian flag", | |
"๐":"diamond | gem | gemstone | jewel | diamonds | gems | gemstones | jewels", | |
"โ ๏ธ":"skull and crossbones | poison | poisonous", | |
"๐ฉโ๐ป":"technology worker | tech worker | technologist | techie | IT worker | Apple genius | woman in technology | woman tech worker | woman technologist | woman IT worker | woman in IT | woman Apple genius", |
// UICollectionView Objective-C example | |
- (void)viewWillAppear:(BOOL)animated { | |
[super viewWillAppear:animated]; | |
NSIndexPath *selectedIndexPath = [[self.collectionView indexPathsForSelectedItems] firstObject]; | |
if (selectedIndexPath != nil) { | |
id<UIViewControllerTransitionCoordinator> coordinator = self.transitionCoordinator; | |
if (coordinator != nil) { | |
[coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context) { |
let emojis: [String: [String]] = [ | |
// +[EMFEmojiCategory TravelAndPlacesEmoji] | |
"travel": ["๐", "๐", "๐", "๐", "๐", "๐", "๐", "๐", "๐", "๐", "๐", "๐", "๐", "๐ด", "๐ฒ", "๐ต", "๐", "๐จ", "๐", "๐", "๐", "๐", "๐ก", "๐ ", "๐", "๐", "๐", "๐", "๐", "๐", "๐ ", "๐", "๐", "๐", "๐", "๐", "๐", "๐", "๐ฉ", "โ๏ธ", "๐ซ", "๐ฌ", "๐", "๐ฐ", "๐บ", "๐ถ", "โต๏ธ", "๐ฅ", "๐ค", "๐ณ", "โด", "๐ข", "โ๏ธ", "๐ง", "โฝ๏ธ", "๐", "๐ฆ", "๐ฅ", "๐บ", "๐ฟ", "๐ฝ", "โฒ๏ธ", "๐ผ", "๐ฐ", "๐ฏ", "๐", "๐ก", "๐ข", "๐ ", "โฑ", "๐", "๐", "โฐ", "๐", "๐ป", "๐", "๐", "๐", "โบ๏ธ", "๐ค", "๐ฃ", "๐", "๐ญ", "๐ ", "๐ก", "๐", "๐", "๐ข", "๐ฌ", "๐ฃ", "๐ค", "๐ฅ", "๐ฆ", "๐จ", "๐ช", "๐ซ", "๐ฉ", "๐", "๐", "โช๏ธ", "๐", "๐", "๐", "โฉ", "๐พ", "๐", "๐", "๐ ", "๐", "๐ ", "๐", "๐", "๐", "๐", "๐", "๐", "๐", "๐", "๐"], | |
// +[EMFEmojiCategory NatureEmoji] | |
"nature": ["๐ถ", "๐ฑ", "๐ญ", "๐น", "๐ฐ", "๐ฆ", "๐ป", "๐ผ", "๐จ", "๐ฏ", "๐ฆ", "๐ฎ", "๐ท", "๐ฝ", "๐ธ", "๐ต", "๐", "๐", "๐", "๐", "๐", "๐ง", "๐ฆ", "๐ค", "๐ฃ", "๐ฅ", "๐ฆ", "๐ฆ ", "๐ฆ", "๐ฆ", "๐บ", "๐", "๐ด", "๐ฆ", "๐", "๐", "๐ฆ", "๐", "๐", "๐", "๐", "๐ท", "๐ธ", "๐ข", "๐", "๐ฆ", "๐ฆ", "๐ฆ", "๐ฆ", "๐", "๐ฆ", "๐ ", "๐", "๐ก", "๐ฌ", "๐ฆ |
// Swift's untyped errors are a goddam PiTA. Here's the pattern I use to try to work around this. | |
// The goal is basically to try to guarantee that every throwing function in the app throws an | |
// ApplicationError instead of some unknown error type. We can't actually enforce this statically | |
// But by following this convention we can simplify error handling | |
enum ApplicationError: Error, CustomStringConvertible { | |
// These are application-specific errors that may need special treatment | |
case specificError1 | |
case specificError2(SomeType) |
Author: Chris Lattner
#!/bin/bash | |
#Setup the environnement | |
mkdir wwdc2017 | |
cd wwdc2017 | |
mkdir tmp_download | |
cd tmp_download | |
#Extract IDs | |
echo "Downloading the index" |