Skip to content

Instantly share code, notes, and snippets.

View AFAgarap's full-sized avatar

Abien Fred Agarap AFAgarap

View GitHub Profile
@AFAgarap
AFAgarap / FIFO.java
Last active January 23, 2017 05:08
Scheduling algorithms in my Operating System course in Adamson University (AY 2016-2017, 1st semester)
/*
FIFO by A.F. Agarap
*/
public class FIFO {
public static void main(String[] args) {
int temp = 0;
int size = input("How many processes will you enter? ");
int [][] process = new int[size][6];
@AFAgarap
AFAgarap / MapToList.java
Created August 29, 2016 06:22
Converting Map to List in Java
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class MapToList {
public static void main(String[] args) {
Map <Integer, String> map = new HashMap<>();
map.put(10, "apple");
map.put(20, "banana");
@AFAgarap
AFAgarap / bankers-algorithm.py
Last active September 22, 2016 03:50
Python implementation of Banker's algorithm, written in Python (3.5.2)
#!/usr/bin/env python3
# Python implementation of Banker's algorithm
# Author : A.F. Agarap
from string import ascii_uppercase
letters = list(ascii_uppercase)
def main():
available_instance = []
@AFAgarap
AFAgarap / paging.py
Created October 1, 2016 13:28
A Python implementation of the Paging memory management scheme in operating systems
#!/usr/bin/env python3
# Paging, a memory management scheme in operating systems
# Author: A.F. Agarap
def main():
page_mapping = []
physical_frame_table = []
virtual_page_table = []
size = int(input("How many words will you enter? "))
@AFAgarap
AFAgarap / deep_net.py
Created October 9, 2016 17:40
Sample Deep Neural Network written in Python on top of TensorFlow
# Based on the tutorial by user `sentdex` : https://www.youtube.com/watch?v=PwAGxqrXSCs
import tensorflow as tf
'''
input -> weight -> hidden layer 1 (activation function) -> weight -> hidden layer 2 (activation function) -> weight -> output layer
'''
from tensorflow.examples.tutorials.mnist import input_data
@AFAgarap
AFAgarap / Euler.java
Last active November 26, 2017 16:15
Euler's Method for solving ODEs
/*
* Copyright 2017 Abien Fred Agarap
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@AFAgarap
AFAgarap / simple-bruteforce.py
Last active August 6, 2017 04:18
A simple bruteforce program for GPG-encrypted files with a 4-digit passphrase.
# Copyright 2017 Abien Fred Agarap. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@AFAgarap
AFAgarap / polynomial-least-squares.py
Last active March 11, 2024 10:22
A program implementation of Polynomial Least Squares written in Python.
# Copyright 2017 Abien Fred Agarap. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@AFAgarap
AFAgarap / cubic-spline.py
Last active September 25, 2017 04:40
An implementation of the Natural Cubic Spline Algorithm.
# Copyright 2017 Abien Fred Agarap. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@AFAgarap
AFAgarap / gru_svm_mnist.py
Last active September 30, 2017 13:06
Implementation of my proposed GRU+SVM model for Zalando's "fashion MNIST" dataset.
# Implementation of my proposed GRU+SVM model, for MNIST classification
# Copyright (C) 2017 Abien Fred Agarap
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of