Skip to content

Instantly share code, notes, and snippets.

View Abdillah's full-sized avatar
🛰️
Bit Explorer

Faïz Hernawan Abdillah

🛰️
Bit Explorer
View GitHub Profile

Keybase proof

I hereby claim:

  • I am abdillah on github.
  • I am fazbdillah (https://keybase.io/fazbdillah) on keybase.
  • I have a public key ASDiKmUvVEKugWEvFpq5IvATiSRwHAqJWE0eV2jybaeDQQo

To claim this, I am signing this object:

@Abdillah
Abdillah / Getting Lost in Unsafe Region snippets
Created October 31, 2020 02:07
Post snippet "Getting Lost in Unsafe Region snippets" on Medium
Post snippet "Getting Lost in Unsafe Region snippets" on Medium
@Abdillah
Abdillah / Cargo.toml
Created September 5, 2020 21:27
Glutin transparent window
[package]
name = "transpi"
version = "0.1.0"
authors = ["Hernawan Faïz Abdillah <hernawan.faiz.abdillah@gmail.com>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
gl = "0.11.0"
@Abdillah
Abdillah / pack.sh
Created July 24, 2020 01:51
Building environment of Android app in NixOS
#!/usr/bin/env bash
tar -czf ./build/source.tar --exclude='./dev' --exclude='./build' ../appname
@Abdillah
Abdillah / vulkan-example.rs
Created June 9, 2020 01:31
Vulkan example
/**
[dependencies]
# The `vulkano` crate is the main crate that you must use to use Vulkan.
vulkano = "0.19.0"
# Provides the `shader!` macro that is used to generate code for using shaders.
vulkano-shaders = "0.19.0"
# The Vulkan library doesn't provide any functionality to create and handle windows, as
# this would be out of scope. In order to open a window, we are going to use the `winit` crate.
winit = "0.22"
# The `vulkano_win` crate is the link between `vulkano` and `winit`. Vulkano doesn't know about winit,
@Abdillah
Abdillah / shell.nix
Created June 6, 2020 07:37
nix-shell template for desktop build
let
nixpkgs = import <nixpkgs-20.03> {};
self = with nixpkgs; nixpkgs.stdenv.mkDerivation rec {
name = "rustodoro-${version}-builder0";
version = "rev-4c34dd";
# Haven't upload yet, but usable for nix-shell.
nativeBuildInputs = [
@Abdillah
Abdillah / sync_val_compare_and_swap.rs
Created May 10, 2020 03:54
Implementation of sync_val_compare_and_swap in ESP8266 (it is very general for embedded actually).
// See https://www.ibm.com/support/knowledgecenter/SSGH2K_13.1.3/com.ibm.xlc1313.aix.doc/compiler_ref/bif_gcc_atomic_val_comp_swap.html
#[cfg(not(feature = "disable-fake-atomics"))]
#[no_mangle]
fn __sync_val_compare_and_swap_1(ptr_exch: *mut u8, cmp: u8, exch: u8) -> u8 {
let oldval = unsafe { *ptr_exch };
if cmp == oldval {
unsafe { core::ptr::write(ptr_exch, cmp) };
}
oldval
}
@Abdillah
Abdillah / xtensa-shell.nix
Last active April 8, 2020 01:34
Building rust-xtensa from source
# Quick start to compile
#
# 0. nix-shell --pure xtensa-shell.nix
# 1. Clone git@github.com:MabezDev/rust-xtensa.git
# 2. $ cd rust-xtensa/
# 3. $ ./configure $configureFlags
# 4. $ python ./x.py --help
# 5. $ python ./x.py build
#
# The rest of the guide, please refer to [MabezDev's](https://github.com/MabezDev/xtensa-rust-quickstart).
/*
A subarray A[i], A[i+1], ..., A[j] of A is said to be turbulent if and only if:
For i <= k < j, A[k] > A[k+1] when k is odd, and A[k] < A[k+1] when k is even;
OR, for i <= k < j, A[k] > A[k+1] when k is even, and A[k] < A[k+1] when k is odd.
That is, the subarray is turbulent if the comparison sign flips between each adjacent pair of elements in the subarray.
Return the length of a maximum size turbulent subarray of A.
@Abdillah
Abdillah / arryaml.php
Last active April 26, 2019 02:39
Array to YAM-like
<?php
/**
* arr2yamlike - JSON-alternative format for human, readable and brief
*/
require_once __DIR__."/../vendor/autoload.php";
use Peridot\Leo\Interfaces\Assert;
/**