Skip to content

Instantly share code, notes, and snippets.

View donn's full-sized avatar

Mohamed Gaber donn

View GitHub Profile
@donn
donn / Target.h
Last active February 13, 2017 15:51
Find out which OS this header file is compiling on.
/*
Target.h
Finds the operating system it is compiling for and has the compiler emit a message. Supports all major OSes.
C/C++/Objective-C
--
This is free and unencumbered software released into the public domain.
@donn
donn / CarryLookAhead.swift
Last active June 24, 2017 00:14
Output a boolean expression for any 1st level carry lookahead.
/*
Carry Look Ahead
Writes a boolean expression for a 1st level carry lookahead.
Modify location as you see fit. Wrote it while immensely confused at an assignment.
Swift
--
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
@donn
donn / Types.h
Last active September 30, 2018 12:32
Convenience header for dealing with C types.
/*
Types.h
Makes C data types more convenient to use. A bit Rusty.
C/C++/Objective-C
--
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
@donn
donn / Commands.sh
Last active September 10, 2023 18:40
Shell Nonsense
# These are commands I find all around the internet that I think are interesting or useful, so I'll keep 'em here:
# (None of these are complex enough to qualify for copyright in my opinion)
# Generate MAC Address
# Credit: https://discussions.apple.com/message/29028339#message29028339
openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//'
# LS alias with all the good stuff
alias ll='ls -lAFh'
@donn
donn / AndroidHTTP101.md
Last active January 14, 2020 20:51
Using Volley, Gson and Picasso for Android Newbies

Android HTTP 101

Manifest

Right below the <manifest /> tag:

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<user-permission android:name="android.permission.INTERNET" />

build.gradle

@donn
donn / NANDEquivalent.swift
Last active August 12, 2017 15:40
Turn any logic into unoptimized NAND-only logic.
/*
Illogical - NAND Equivalent
That was my first Swift program. You can tell, really.
I also wrote it before I knew tokenization was a thing, so the code's... nightmarish.
This is a simple program that takes a logical proposition
and outputs an (unoptimized) NAND equivalent. It was written
as a project for a discrete mathematics course.
@donn
donn / GPA.playground
Last active December 2, 2017 12:14
GPA projection Swift playground thing
/* vim: syntax=swift */
/*
GPA Calculator
...I got tired of having to re-enter my GPA in AIS's JavaScript mess, so there you have it.
Swift
--
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
#!/usr/bin/env python3
# Calculator
# Product of a Python Lex-Yacc tutorial.
# Python 3
# --
# This is free and unencumbered software released into the public domain.
# Anyone is free to copy, modify, publish, use, compile, sell, or
/* vim: syntax=swift */
/*
TruthTable.plaground
A truth table generator with a syntax as ugly as sin.
Swift
--
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
@donn
donn / Bootcamp.ahk
Created May 24, 2018 18:02
My MacBook's autohotkey setup
; Boot Camp AutoHotkey Bindings
;
; Removes some of the "Damn you, muscle memory" involved with Boot Camp
;
; AutoHotkey
; --
; This is free and unencumbered software released into the public domain.
; Anyone is free to copy, modify, publish, use, compile, sell, or
; distribute this software, either in source code form or as a compiled
; binary, for any purpose, commercial or non-commercial, and by any