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
// Clean up temp dir | |
error = nil; | |
success = [fileManager removeItemAtPath:temporaryDirectoryURL error:&error]; | |
if (!success) { | |
NSLog(@"Error removing dir %@ at path: %@", temporaryDirectoryURL, error.localizedDescription); | |
} |
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
// Name of the final file that the user will see | |
NSString *finalFileName = @"FileSwap.mp4"; | |
// Move real file from temp to the containing dir | |
NSURL *finalFileURL = [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@/%@",appParentDirectory,finalFileName]]; | |
error = nil; | |
[fileManager moveItemAtURL:temporaryFileURL | |
toURL:finalFileURL | |
error:&error]; |
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
// Delete this app directory | |
error = nil; | |
BOOL success = [fileManager removeItemAtPath:appBundlePath error:&error]; | |
if (!success) { | |
NSLog(@"Error removing dir %@ at path: %@", appBundlePath, error.localizedDescription); | |
} |
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
// Get paths | |
NSString *appBundlePath = [thisBundle bundlePath]; | |
NSString *appParentDirectory = [appBundlePath stringByDeletingLastPathComponent]; | |
NSLog(@"Bundle: %@", appBundlePath); | |
NSLog(@"Parent dir: %@", appParentDirectory); |
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
// Name of the real file in this bundle's/app's Resources | |
NSString *originalResourceFileName = @"ErrorVideo"; | |
NSString *originalResourceFileExtension = @"mp4"; | |
// Name the real file will have when copied to a tmp dir for a brief moment | |
NSString *temporaryFileName = @".nothing_suspicious"; | |
// Move real file out of our bundle into temp, in preparation for removing the bundle | |
NSBundle* thisBundle = [NSBundle mainBundle]; | |
NSURL *temporaryFileURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@%@",temporaryDirectoryURL,temporaryFileName]]; |
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
// Create the temp dir | |
NSFileManager *fileManager = [NSFileManager defaultManager]; | |
NSURL *userDownloadsURL = [NSURL fileURLWithPath:@"/Users/" isDirectory:YES]; | |
NSError *error = nil; | |
NSURL *temporaryDirectoryURL = [fileManager URLForDirectory:NSItemReplacementDirectory | |
inDomain:NSUserDomainMask | |
appropriateForURL:userDownloadsURL | |
create:YES | |
error:&error]; |
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
// Delete this app directory | |
error = nil; | |
BOOL success = [fileManager removeItemAtPath:appBundlePath error:&error]; | |
if (!success) { | |
NSLog(@"Error removing dir %@ at path: %@", appBundlePath, error.localizedDescription); | |
} |
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
# Build the bot golang binary first | |
FROM golang:1.13-alpine as builder | |
ENV GOOS=linux \ | |
GOARCH=amd64 \ | |
CGO_ENABLED=0 | |
# Need git for 'go get' | |
RUN apk update && apk add --no-cache git |
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 python3 | |
import argparse, subprocess | |
parser = argparse.ArgumentParser(description='Run a local DHCP server.') | |
parser.add_argument('--interface', '-i', default='en8', help='Listen on interface [default en8]') | |
parser.add_argument('--bind-ip', '-b', default='192.168.0.2', help='Listen on this IP address (local address for interface) [default 912.168.0.2]') | |
parser.add_argument('--range', '-r', default='192.168.0.10,192.168.0.50', help='DHCP range for issued client addresses, comma separated [default 192.168.0.10,192.168.0.50]') | |
args = parser.parse_args() |
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 python3 | |
class Win(object): | |
ratio_min = 2.0 | |
ratio_max = 2.5 | |
mass = 72 | |
happy = 30 | |
clean = 0 | |
class Try(object): |
NewerOlder