Skip to content

Instantly share code, notes, and snippets.

View Izzur's full-sized avatar
🏠
Working from home

Izzur Zuhri Izzur

🏠
Working from home
View GitHub Profile
@Izzur
Izzur / backup-s3.sh
Created October 28, 2022 05:25
Replace space with underscore and backup to s3 with md5 as filename
#!/usr/bin/env bash
for f in *; do
mv "$f" `echo $f | tr ' ' '_'`;
done
for f in *; do
echo $f;
echo $f | md5sum | awk '{print $1}';
aws s3 cp $f s3://bucket-name-something/$(echo $f | md5sum | awk '{print $1}');
@Izzur
Izzur / commarize.js
Created March 28, 2021 06:08
Javascript Commarization
// From https://gist.github.com/MartinMuzatko/1060fe584d17c7b9ca6e
const commarize = (n) => {
if (n >= 1e3) {
const units = [" thousand", " million", " billion", " trillion"];
let unit = Math.floor((n.toFixed(0).length - 1) / 3) * 3;
const num = (n / ("1e" + unit)).toFixed(2);
const unitname = units[Math.floor(unit / 3) - 1];
return num + unitname;
}
@Izzur
Izzur / pattern1.java
Created May 8, 2017 14:43
Draw some pattern for fun
public class pattern1 {
public static void main(String[] args) {
int n = Integer.parseInt(args[0]);
if(n == 1) System.out.println("x "); else
printPattern(n);
}
private static void printPattern(int n) {
boolean genap = (n%2 == 0) ? true : false;
String basePattern = "";
for (int i=0; i<(genap ? (n/2) : (n/2+1)); i++) {
@Izzur
Izzur / list_group.xml
Created May 14, 2016 06:16
Layout Expandable List View
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="8dp"
android:background="#000000">
<TextView