Skip to content

Instantly share code, notes, and snippets.

View nikAizuddin's full-sized avatar
⚠️
s t a t i c

Nik Mohamad Aizuddin nikAizuddin

⚠️
s t a t i c
View GitHub Profile
@nikAizuddin
nikAizuddin / main.py
Created October 28, 2019 14:39
[Tensorflow/Keras] Example how to measure average time taken per batch
# -*- coding: utf-8 -*-
"""Example how to measure average time taken per batch.
"""
import time
import numpy as np
import pandas as pd
from tensorflow.keras.models import Model
from tensorflow.keras.layers import Input, Dense
@nikAizuddin
nikAizuddin / kmeans-img_compression.m
Last active October 22, 2018 00:10
Image compression using KMeans
%% Global configurations.
SOURCE_IMAGE = 'lena.png';
N_CENTROIDS = 3;
%% Load source image and pre-processed for KMeans.
src = imread(SOURCE_IMAGE);
#!/bin/sh
##==============================================================================
## PROBLEM STATEMENT
## -----------------
## Currently, transfering files between FreeBSD 10.3 computer and iPhone 6
## (IOS 10.3.3) causes Input/Output errors. The errors are randomly occured
## during the file transfering process. Whenever the error occured, the file
## transfering process will fail and the computer is required to re-mount the
## iPhone again before resuming the file transfering.
@nikAizuddin
nikAizuddin / knuth_books.sh
Created May 23, 2017 03:36
UNIX Shell script to download four volumes of The Art of Computer Programming by Donald E. Knuth.
#!/bin/sh
################################################################################
## ##
## The Art of Computer Programming by Donald E. Knuth. ##
## ##
################################################################################
## Volume 1 - Fundamental Algorithms, 3rd Edition
@nikAizuddin
nikAizuddin / bfgs_example_1.c
Created February 8, 2017 17:12
Minimize a quadratic function f(x) by using BFGS algorithm.
/* 1 2 3 4 5 6 7
345678901234567890123456789012345678901234567890123456789012345678901
+--------------------------------------------------------------------
| BFGS Example 1
+--------------------------------------------------------------------
| This example is based on Example 11.4 from
| "Introduction to Optimization" book written by Chong, Edwin K.P.,
| and Stanislaw H. Zak.
|
| We are going to minimize this quadratic function f(x) by using
@nikAizuddin
nikAizuddin / oreilly-freebooks.sh
Last active October 20, 2020 03:34
This UNIX Shell script will download most O'Reilly free pdf books about Programming, Security, Business, Data, Design, IoT, WebDev, and WebOps from http://www.oreilly.com/programming/free/.
#!/bin/sh
################################################################################
## This UNIX Shell script will download most O'Reilly free pdf books
## about Programming, Security, Business, Data, Design, IoT, WebDev, and WebOps
## from http://www.oreilly.com/programming/free/.
## There are a few books that are non-free, so I don't list them here.
##
## --- How to RUN? ---
## $ sh -e oreilly-freebooks.sh
@nikAizuddin
nikAizuddin / compare_float.sh
Last active August 29, 2015 14:11
How to compare float numbers
#!/bin/bash
#=====================================================================
# FILE: compare_float.sh
#
# USAGE: bash compare_float.sh
#
# DESCRIPTION: This script shows how to compare float numbers.
#
# REQUIREMENTS: ---
# BUGS: ---
@nikAizuddin
nikAizuddin / nestedStruct_linkedList.c
Created December 11, 2014 14:05
ANSI-C: Nested structure in Linked List.
/**
* ANSI-C: Nested structure in Linked List.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct subject_t {
char name[32];
} subject_t;
@nikAizuddin
nikAizuddin / int2str_wo_lib.cpp
Created December 6, 2014 16:39
Convert integer to string without using any library
//////////////////////////////////////////////////////////////////////
// //
// Convert integer to string without using any library. //
// //
//////////////////////////////////////////////////////////////////////
#include <iostream>
#include <string>
using namespace std;
@nikAizuddin
nikAizuddin / fsqrt.cpp
Created December 6, 2014 15:34
C++ using x87 FSQRT instruction
#include <iostream>
using namespace std;
double x = 1.25;
double result = 0.00;
int main()
{
asm(