Skip to content

Instantly share code, notes, and snippets.

View hbina's full-sized avatar
🐕
hopefully doing something useful...

Hanif Ariffin hbina

🐕
hopefully doing something useful...
View GitHub Profile
@hbina
hbina / builder.py
Created November 1, 2025 05:45
Python script to manage docker builds
#!/usr/bin/env python3
"""
Docker management script for GCC 15.2.0 builder.
Replaces docker-compose with simple Python commands.
"""
import subprocess
import sys
import argparse
@hbina
hbina / .cargo config.toml
Created March 12, 2023 04:23
Compiles dependency in perf mode but application in debug
[profile.dev.package."*"]
opt-level = 3
@hbina
hbina / BsonViewer.tsx
Created June 26, 2022 09:50
React BSON Component
import React from "react";
import CSS from "csstype";
import { GREEN_COLOR_THEME, RUSTY_COLOR_THEME } from "../constant";
const getBsonType = (value: any) => {
if (typeof value === "object" && value === null) {
return "null";
} else if (typeof value === "object" && value !== null) {
if (typeof value["$oid"] === "string") {
return "ObjectID";
@hbina
hbina / macro.rs
Created May 26, 2022 05:38
Rust macro_rules to generate as_str, from_str, sqlx::Encode, sqlx::Decode for enums
#[macro_export]
macro_rules! impl_enum_asfrom_str {
($name:ident, $($next_variant:ident),+) => {
#[derive(::std::clone::Clone, Copy, Debug, Deserialize, Serialize)]
#[allow(clippy::upper_case_acronyms)]
#[allow(non_camel_case_types)]
pub enum $name {
$($next_variant),+
}
@hbina
hbina / maybe_number.ts
Last active September 29, 2021 07:57
Possible Implementation of MaybeNumber in TypeScript?
class MaybeNumber {
constructor(private readonly value?: number) {
}
// We could have used the constructor but it's not really nice to
// write `new` everywhere.
static create(n: number): MaybeNumber {
return new MaybeNumber(n);
}
static empty(): MaybeNumber {
@hbina
hbina / list_homomorphism.ts
Last active September 26, 2021 09:34
Maximum Subarray Sum (MSS) solution in TypeScript using List Homomorphism
// Basically need to satisfy this constraint
// f(list_one + list_two) === homo_list(f(list_one), f(list_two));
// The function 'f' is a list homomorphism if there exists a function `homo_list` that satisfy the above equation
type IntermediateState = {
mss: number, // the actual MSS of a given array
mss_from_left: number, // the MSS if we force subarray to include the first element
mss_from_right: number, // the MSS if we force the subarray to include the last element
total_sum: number // simply the total sum of the array
}
# Docker configurations
image: ubuntu:latest
test:
except:
- tags
script:
# Configure TZ
- export TZ=Europe/Kiev
- ln -snf /usr/share/zoneinfo/$TZ /etc/localtime
This file has been truncated, but you can view the full file.
2021-02-19T01:05:38.6554830Z ##[section]Starting: Request a runner to run this job
2021-02-19T01:05:39.1605904Z Can't find any online and idle self-hosted runner in current repository that matches the required labels: 'ubuntu-latest'
2021-02-19T01:05:39.1606001Z Can't find any online and idle self-hosted runner in current repository's account/organization that matches the required labels: 'ubuntu-latest'
2021-02-19T01:05:39.1606206Z Found online and idle hosted runner in current repository's account/organization that matches the required labels: 'ubuntu-latest'
2021-02-19T01:05:39.2767053Z ##[section]Finishing: Request a runner to run this job
2021-02-19T01:05:44.1181915Z Current runner version: '2.277.1'
2021-02-19T01:05:44.1210483Z ##[group]Operating System
2021-02-19T01:05:44.1211536Z Ubuntu
2021-02-19T01:05:44.1212064Z 20.04.2
2021-02-19T01:05:44.1212487Z LTS
@hbina
hbina / building release is fine
Last active February 14, 2021 10:42
Compiling lupinas-lullaby
lupinas-lullaby on  master [!] is 📦 v0.1.8 via ⬢ v14.15.2 via 🦀 v1.50.0
❯ cargo build --release
Finished release [optimized] target(s) in 0.04s
@hbina
hbina / figure.tex
Created June 4, 2020 19:04
How to include a figure in LaTeX
\begin{figure}[H]
\center{\includegraphics[width=\textwidth]
{figures/biotensor.png}}
\caption{\label{fig:my-label} My figure. An example of a cool figure}
\end{figure}