Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# Props to https://gist.github.com/kaleksandrov/3cfee92845a403da995e7e44ba771183 from whom I took the code inside
# the conditional.
THIS_SCRIPT_INVOCATION=$0
# The return status of this function will be 0 if globalprotect is running, 1 if not running because grep returns 0
# if it finds a match and 1 if not.
# We basically grep for globalprotect but exclude all the matches we don't want
@fay59
fay59 / Quirks of C.md
Last active January 23, 2024 04:24
Quirks of C

Here's a list of mildly interesting things about the C language that I learned mostly by consuming Clang's ASTs. Although surprises are getting sparser, I might continue to update this document over time.

There are many more mildly interesting features of C++, but the language is literally known for being weird, whereas C is usually considered smaller and simpler, so this is (almost) only about C.

1. Combined type and variable/field declaration, inside a struct scope [https://godbolt.org/g/Rh94Go]

struct foo {
   struct bar {
 int x;
Jan 27 19:39:29 spaziale itunesstored[108] <Warning>: [ApplicationWorkspace]: Installing software package with bundleID: com.placemarker.places: bundleVersion: 3 path: /var/mobile/Media/Downloads/-5310997826876130007/1030928563015335669
Jan 27 19:39:29 spaziale itunesstored[108] <Warning>: LaunchServices: installing app for existing placeholder <LSApplicationProxy: 0x1266a69d0> com.placemarker.places (Placeholder) <file:///private/var/mobile/Containers/Bundle/Application/81C017B2-D164-4083-9A4A-010C3CE0EF39/-5310997826876130007.app>
Jan 27 19:39:29 spaziale itunesstored[108] <Warning>: LaunchServices: Creating installProgressForApplication:<LSApplicationProxy: 0x1266a69d0> com.placemarker.places (Placeholder) <file:///private/var/mobile/Containers/Bundle/Application/81C017B2-D164-4083-9A4A-010C3CE0EF39/-5310997826876130007.app> withPhase:1
Jan 27 19:39:29 spaziale lsd[82] <Warning>: LaunchServices: Updating installPhase for parent <NSProgress: 0x146660300> : Parent: 0x0 / Fraction completed: 0.5800 / Complete
@joelekstrom
joelekstrom / gist:25ebb46b04c17520845b
Created June 14, 2015 19:58
Completely reset OSX Server
sudo xcrun xcscontrol --shutdown # Stops Xcode Server
sudo xcrun xcscontrol --reset # Resets Xcode Server, removing all service data and stopping all services
## Thanks to http://blog.stuart.shelton.me/archives/2563
@FiloSottile
FiloSottile / 32.asm
Last active May 16, 2024 19:56
NASM Hello World for x86 and x86_64 Intel Mac OS X (get yourself an updated nasm with brew)
; /usr/local/bin/nasm -f macho 32.asm && ld -macosx_version_min 10.7.0 -o 32 32.o && ./32
global start
section .text
start:
push dword msg.len
push dword msg
push dword 1
mov eax, 4