Skip to content

Instantly share code, notes, and snippets.

View leptos-null's full-sized avatar
🏔️
Darwin tooling

Leptos leptos-null

🏔️
Darwin tooling
View GitHub Profile
@leptos-null
leptos-null / printBitRepresentation.h
Last active September 2, 2018 01:49
Three macros for printing the bit representation of a fixed-point value
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
/* prints each character representation of the byte one at a time.
* no memory management required; slower, than using a buffer.
*/
#define printBitRepresentationEach(a) \
({ \
for (size_t _i = (sizeof(a) * CHAR_BIT); _i; _i--) { \
@leptos-null
leptos-null / polymaths.c
Last active September 21, 2018 15:23
Implementation of Descartes' Rule of Signs and Rational Zeros Theorem to show information about a given rational polynomial
//
// main.c
// polymaths
//
// Created by Leptos on 9/18/18.
// Copyright © 2018 Leptos. All rights reserved.
//
#include <stdio.h>
#include <math.h>
@leptos-null
leptos-null / lw.zsh
Last active September 21, 2018 22:19
List which: zsh function to print full information about a command
function lw() {
for ARG in "$@"
do
WHICH_RESULT=$(which "$ARG") && {
[[ -e "$WHICH_RESULT" ]] && {
l "$WHICH_RESULT"
continue
}
}
echo "$WHICH_RESULT"
@leptos-null
leptos-null / YTIThumbnailDetails.md
Last active December 15, 2018 22:57
Odd encoding in YTIThumbnailDetails property list

YTIThumbnailDetails classdump notes

While class dumping YouTube Music, I ran into two problematic properties in a protobuf-generated class.

The property largestImageSource had the type encoding

{YTImageSource=@@{YTClientResource=@@{optional<unsigned int>=B(?={dummy_type=[4{empty_struct=}]}I)}}{optional<unsigned int>=B(?={dummy_type=[4{empty_struct=}]}I)}{optional<unsigned int>=B(?={dummy_type=[4{empty_struct=}]}I)}}
@leptos-null
leptos-null / inspectivec.cy
Last active December 15, 2018 23:31
InspectiveC module for Cycript
/* InspectiveC by DavidGoldman
* Place this file in `/usr/lib/cycript0.9/com/golddavid/inspectivec.cy`
* Run `@import com.golddavid.inspectivec` in cycript to use.
*
* This file has been adapted from
* https://github.com/DavidGoldman/InspectiveC/blob/master/cycript/InspectiveC.cy
* to use new cycript module features.
*
* This module is based on
* https://github.com/limneos/classdump-dyld/blob/master/classdumpdyldlib/classdumpdyld.cy
@leptos-null
leptos-null / protobuf.nanorc
Last active December 19, 2018 23:50
Protobuf syntax highlighting for nano
## Protobuf syntax highlighting for nano by Leptos
## Based off creekpld's Swift syntax highlighter
syntax "Protobuf" "\.proto$"
# Default
color white ".+"
# Keywords
color yellow "^ *\<(syntax|package|import|option)\>"
@leptos-null
leptos-null / floating.c
Created March 3, 2019 23:00
Visualizing and understanding IEEE 754 floating point values
//
// floating.c
// funbits
//
// Created by Leptos on 8/18/18.
// Copyright © 2018 Leptos. All rights reserved.
//
#include <stdio.h>
#include <stdlib.h>
@leptos-null
leptos-null / UIOrientationPortableState.h
Created April 26, 2019 04:01
An idea for maintaining orientation state through notify_state
union UIOrientationPortableState {
struct UIOrientationState {
enum UIOrientation { /* this is UIInterfaceOrientation, but unsigned */
UIOrientationUnknown,
UIOrientationPortrait,
UIOrientationPortraitUpsideDown,
UIOrientationLandscapeRight,
UIOrientationLandscapeLeft
}
current : 3, // may be the orientation the device is transitioning to, if transition != UITransitionPhaseZero
@leptos-null
leptos-null / taylor_sin.c
Last active April 28, 2019 19:16
A C sine routine implemented using a Taylor series
//
// taylor_sin.c
//
// Created by Leptos on 4/25/19.
// Copyright © 2019 Leptos. All rights reserved.
//
#include <math.h> // not required- included only for the M_PI macros which are also included below
#include <errno.h> // needed to set errno in the even that the input of sin is an infinity
@leptos-null
leptos-null / progress_bar.c
Last active April 28, 2019 19:37
Example of a VT100 progress bar in C
//
// progress_bar.c
//
// Created by Leptos on 2/17/19.
// Copyright © 2018 Leptos. All rights reserved.
//
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>