Skip to content

Instantly share code, notes, and snippets.

Avatar
🏔️
Darwin tooling

Leptos leptos-null

🏔️
Darwin tooling
View GitHub Profile
@leptos-null
leptos-null / printBitRepresentation.h
Last active Sep 2, 2018
Three macros for printing the bit representation of a fixed-point value
View printBitRepresentation.h
#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 Sep 21, 2018
Implementation of Descartes' Rule of Signs and Rational Zeros Theorem to show information about a given rational polynomial
View polymaths.c
//
// 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 Sep 21, 2018
List which: zsh function to print full information about a command
View lw.zsh
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 Dec 15, 2018
Odd encoding in YTIThumbnailDetails property list
View YTIThumbnailDetails.md

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 Dec 15, 2018
InspectiveC module for Cycript
View inspectivec.cy
/* 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 Dec 19, 2018
Protobuf syntax highlighting for nano
View protobuf.nanorc
## 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 Mar 3, 2019
Visualizing and understanding IEEE 754 floating point values
View floating.c
//
// 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 Apr 26, 2019
An idea for maintaining orientation state through notify_state
View UIOrientationPortableState.h
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 Apr 28, 2019
A C sine routine implemented using a Taylor series
View taylor_sin.c
//
// 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 Apr 28, 2019
Example of a VT100 progress bar in C
View progress_bar.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>