Skip to content

Instantly share code, notes, and snippets.

View eloraiby's full-sized avatar

Wael El Oraiby eloraiby

View GitHub Profile
//
// Copyright 2020-Present (c) Wael El Oraiby
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
@eloraiby
eloraiby / STM32F103.md
Last active September 4, 2020 01:48
Setup Stm32f103 blue pill under vscode

stm32f103 Blue pill C/C++ programming

In STM32CubeMX, enable debugging: Pinout & Configuration > System Core > SYS > Mode > Debug: Enable.

Then under Project Manager > Toolchain/IDE: Makefile

Inside VSCode, add a configuration in launch.json:

        {
            "name": "GDB",
@eloraiby
eloraiby / defer.c
Last active July 31, 2020 11:31
defer implementation in Clang/Gcc
//
// Copyright 2020-Present(c) Wael El Oraiby
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software
// and associated documentation files (the "Software"), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge, publish, distribute,
// sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
fn main() {
}
#[cfg(test)]
mod tests {
#[test]
fn test_for() {
let mut v = Vec::new();
for i in 0..10 {
v.push(i);
@eloraiby
eloraiby / Monomorphism.fs
Created August 18, 2018 21:47
Monomorphic type system in F#
module TypeSystem
type HashTable<'T, 'V> = System.Collections.Generic.Dictionary<'T, 'V>
let varId = ref 0
let nextId() =
let r = !varId
varId := r + 1
r
@eloraiby
eloraiby / typing.md
Created August 13, 2018 01:43 — forked from chrisdone/typing.md
Typing Haskell in Haskell

Typing Haskell in Haskell

MARK P. JONES

Pacific Software Research Center

Department of Computer Science and Engineering

Oregon Graduate Institute of Science and Technology

@eloraiby
eloraiby / HashTable.c
Last active May 22, 2018 13:38
HashTable implementation using 2 buffers (1 for pointers and 1 for elements). It uses the linked list approach.
//
// Copyright (c) 2018 Wael El Oraiby
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
@eloraiby
eloraiby / arch-chromebook.md
Last active May 12, 2018 13:44 — forked from chrisdiana/arch-chromebook.md
Arch Linux on Chromebook Flip C100P

The ASUS Chromebook Flip C100P (veyron_minnie) is the world's first 10" convertible Chromebook with a full metal chassis, so a user can go from laptop to tablet form factor in a snap. The ASUS Chromebook Flip is powered by a Rockchip quad-core processor with 2GB RAM for incredible performance.

It has a 10-finger multi-touch screen, with a comfortable wide key-pitch keyboard and up to 8 hours battery life for all-day mobile use. The connectivity with dual-band WiFi 802.11ac & BT4.0 support can also provide up to 3 times the speed of 802.11n for faster data transfer. Carved from a single block of aluminum for a seamless design, the ASUS Chromebook Flip is not only beautiful, but durable, too.

These instructions will create a dual-booting environment where you can switch between booting Arch Linux ARM and the stock ChromeOS. No changes are made to the internal eMMC drive, and your new Arch Linux ARM install will run completely from external storage. This is the recommended setup for those that just want to tak