Skip to content

Instantly share code, notes, and snippets.

View bobaikato's full-sized avatar
😏
building Jipo

n乇ᴏ bobaikato

😏
building Jipo
View GitHub Profile
@bobaikato
bobaikato / PrimeListBetweenTwoNumbers.java
Last active February 17, 2018 11:01
Get list all prime numbers between the range of two numbers.
List<Integer> getPrimeListBetweenTwoNumbers(int first, int second) {
List<Integer> primeList = new ArrayList<>();
for (int i = Math.min(first, second); i < Math.max(first, second); ++i) {
Boolean isPrime = true;
for (int j = 2; j < i; ++j) {
if (i % j == 0) {
isPrime = false;
break;
}
}
#!/usr/bin/python
import threading
import time
from flask import Flask
app = Flask(__name__)
@app.before_first_request
def activate_job():
def run_job():
@bobaikato
bobaikato / logger.py
Last active February 3, 2018 16:21
This is simple Python logging class template. Feel free to use it.
#!/usr/bin/python
# Created by IntelliJ IDEA.
# Author: Bobai Kato <www.bobaikato.io>
import logging
class Logger:
@bobaikato
bobaikato / base64-encoding.py
Created February 1, 2018 15:28
Revoming b' from ended string in Python
import base64
encoded = base64.b64encode(b'data to be encoded')
print(encoded)
print(encoded.decode("utf-8"))
@bobaikato
bobaikato / array_flattener.py
Created February 1, 2018 19:49
How to flatten an array of arbitrarily nested arrays of integers into a flat array of integers.
def flattened_array(array):
results = []
for item in array:
if type(item) is int:
results.append(item)
else:
results += flattened_array(item)
return results
public static int[] removeDuplicates(int[] arr) {
return Arrays.stream(arr)
.distinct()
.toArray();
}
public class ReverseStringRecursivelyAndRecursively {
private static String reverseStringRecursively(String string) {
char[] newString = string.toCharArray();
int length = newString.length - 1;
return reverseStringRecursively(newString, length);
import java.util.LinkedHashSet;
import java.util.stream.Collectors;
public class removeRedundatCharacterFromStringJAVA8 {
private static String removeDuplicate(String string) {
LinkedHashSet<Character> lhs = new LinkedHashSet<>();
for (int i = 0; i < string.length(); i++)
lhs.add(string.charAt(i));
#!/bin/bash
#Script to Delete all S3 Buckets Except cloudtrail-awslogs
#Author: Bobai Kato <https://www.bobaikato.io/>
#Date: October 20, 2017
#Create File to save bucket names
aws s3 ls >> my_buckets.txt
more my_buckets.txt
@bobaikato
bobaikato / riot-matrix-workshop.md
Created August 15, 2018 13:27 — forked from attacus/riot-matrix-workshop.md
Create your own encrypted chat server with Riot and Matrix

Running your own encrypted chat service with Matrix and Riot

Workshop Instructor:

This workshop is distributed under a CC BY-SA 4.0 license.

What are we doing here?

The goal of this workshop is to teach you how to configure and run your own Matrix/Riot service. By the end of the workshop, you should be able to log into secure chat rooms and invite others to the same server.