Skip to content

Instantly share code, notes, and snippets.

@holzschu
holzschu / LLVM_for_iOS.sh
Last active June 14, 2024 05:04
Cross-compiling LLVM for iOS
#! /bin/bash
curl http://releases.llvm.org/6.0.0/llvm-6.0.0.src.tar.xz -O
tar xvzf llvm-6.0.0.src.tar.xz
rm llvm-6.0.0.src.tar.xz
cd llvm-6.0.0.src
# get clang
pushd tools
curl http://releases.llvm.org/6.0.0/cfe-6.0.0.src.tar.xz -O
@holzschu
holzschu / callback.m
Created January 11, 2018 08:11
Sample complete callback for linenoise (https://github.com/antirez/linenoise)
// Array of all commands available:
NSArray* commandList;
// Commands that don't take a file as argument (uname, ssh, mosh...):
NSArray* commandsNoFile;
void completion(const char *command, linenoiseCompletions *lc) {
// autocomplete command for lineNoise
BOOL isDir;
NSString* commandString = [NSString stringWithUTF8String:command];
if ([commandString rangeOfString:@" "].location == NSNotFound) {
@holzschu
holzschu / Parser.m
Created December 22, 2017 22:32
Argument parsing for command lines, includes conversion from scp to curl
- (char **) makeargs:(NSMutableArray*) listArgv argc:(int*) argc
{
// Assumes the command line has been separated into arguments, parse the arguments if needed
// does some conversions (~ --> home directory, for example, plus environment variables)
// Most of the heavy parsing is done in ios_system.m (check if command is a file, etc)
// If the command is "scp" or "sftp", do not replace "~" on remote file locations, but
// edit the arguments (we simulate scp and sftp by calling "curl scp://remotefile")
if ([listArgv count] == 0) { *argc = 0; return NULL; }
NSString* cmd = [listArgv objectAtIndex:0];
// Re-concatenate arguments with quotes (' and ")