Skip to content

Instantly share code, notes, and snippets.

View hoanbka's full-sized avatar
💭
while I < YOU: I++

Hoan Nguyen Van hoanbka

💭
while I < YOU: I++
  • Hanoi, Vietnam
View GitHub Profile
@hoanbka
hoanbka / SizeCalculationUsingQueue.java
Created September 12, 2016 15:43
Calculate the size of the directory using queue
package sizecalculation;
import java.io.File;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Queue;
public class SizeCalculationUsingQueue {
private static Queue<File> queue = new LinkedList<>();
@hoanbka
hoanbka / SizeCalculationUsingQueue2.java
Created September 12, 2016 15:43
Calculate the size of the directory using queue
package sizecalculation;
import java.io.File;
import java.util.*;
public class SizeCalculationUsingQueue2 {
private static Queue<File> queue = new LinkedList<>();
static long size = 0;
public static long getSize(File dir) {
@hoanbka
hoanbka / CalculateSizeOfFolderUsingStack.java
Created September 12, 2016 16:15
Calculate the size of the directory using Stack
package sizecalculation;
import java.io.File;
import java.util.Arrays;
import java.util.Stack;
public class CalculateSizeOfFolderUsingStack {
private static Stack<File> stack = new Stack<>();
private static long size = 0;
package com.hoanbka.javafx.practice;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.VBox;
@hoanbka
hoanbka / Exercise_08_10.java
Created September 22, 2016 15:27
* (Largest row and column) Write a program that randomly fills in 0s and 1s into * * a 4-by-4 matrix, prints the matrix, and finds the first row and column with * * the most 1s.
package chapter8_10;
/**
* Created by hoanbka on 22-Sep-16.
*/
/*********************************************************************************
* (Largest row and column) Write a program that randomly fills in 0s and 1s into *
* a 4-by-4 matrix, prints the matrix, and finds the first row and column with *
* the most 1s. *
*********************************************************************************/
@hoanbka
hoanbka / FilterFile.java
Created October 3, 2016 16:14
MessageFilter
package filterfile;
import java.io.*;
import java.util.concurrent.LinkedBlockingQueue;
/**
* Created by hoanbka on 03-Oct-16.
*/
public class FilterFile {
private static final File file = new File("D:\\Test\\fuck.txt");
@hoanbka
hoanbka / start_monogd_in_ubuntu_server.sh
Created November 11, 2016 10:38 — forked from dineshsprabu/start_monogd_in_ubuntu_server.sh
[Mongodb] Starting MongoDB as a service with wiredTiger, default DBPath and LogPath
sudo mongod --dbpath="/var/lib/mongodb" --fork --logpath /var/log/mongodb.log --storageEngine "wiredTiger"
@hoanbka
hoanbka / timer_with_javascript.js
Created November 11, 2016 10:39 — forked from dineshsprabu/timer_with_javascript.js
[JAVASCRIPT] Timer with javascript.
<script>
function pretty_time_string(num) {
return ( num < 10 ? "0" : "" ) + num;
}
var start = new Date;
setInterval(function() {
var total_seconds = (new Date - start) / 1000;
@hoanbka
hoanbka / calculateSizeFolderUsingStack.js
Created January 10, 2017 10:01
calculateSizeFolderUsingStack.js
/**
* Created by Albert on 1/10/2017.
*/
var async = require('async');
const fs = require('fs');
function getSizeFile(path) {
var size;
var stats = fs.statSync(path);
size = stats.size;
return size;
@hoanbka
hoanbka / CalculateSizeFolder.py
Created January 24, 2017 08:38
Calculate the size of the folder using Python
import os
res = []
def readFolder(file):
if os.path.isfile(file):
res.append(os.path.getsize(file))
else:
arr = os.listdir(file)
for element in arr: