Skip to content

Instantly share code, notes, and snippets.

View ardinusawan's full-sized avatar
👍
lgtm

I Dewa Putu Ardi Nusawan ardinusawan

👍
lgtm
View GitHub Profile
@ardinusawan
ardinusawan / TOTP.java
Created December 4, 2016 16:10
RFC 6238 OTP - 10 digits (Modified from https://tools.ietf.org/html/rfc6238)
import java.lang.reflect.UndeclaredThrowableException;
import java.security.GeneralSecurityException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.math.BigInteger;
import java.util.TimeZone;
@ardinusawan
ardinusawan / merge_multiple_csv.py
Created April 7, 2017 21:09
This python program using pandas for merge multiple (not just 2!) csv file based on primary key
# http://pandas.pydata.org/pandas-docs/stable/merging.html
# Search on 'Brief primer on merge methods (relational algebra)'
import pandas as pd
csv_input = pd.read_csv('./file_A.csv')
df = pd.DataFrame(csv_input)
csv_input2 = pd.read_csv('./file_B.csv')
df2 = pd.DataFrame(csv_input2)
combined = pd.merge(csv_input, csv_input2, on='Primary Key')
combined.to_csv('output.csv', index=False)
@ardinusawan
ardinusawan / run.py
Created April 28, 2017 14:21
Secret Key [Hackerrank CTF] - Medium
# https://www.hackerrank.com/contests/capture-the-flag/challenges/secret-key/copy-from/1301466914
from urllib import urlopen
import json
import ast
url = urlopen('https://cdn.hackerrank.com/hackerrank/static/contests/capture-the-flag/secret/key.json').read().decode('utf8')
result = json.dumps(json.loads(url))
result = ast.literal_eval(result)
i = 0
data = list()
@ardinusawan
ardinusawan / pdf2png.py
Created June 2, 2017 19:51
Converting pdf to png using python
for pdfile in *.pdf ; do
convert -verbose -density 500 "${pdfile}" -quality 100 "${pdfile%.*}".png
# rm "${pdfile}"
done
@ardinusawan
ardinusawan / autossh.service
Last active June 14, 2019 02:51
autossh daemon service
[Unit]
Description=Auto SSH Service
Wants=network-online.target
After=network-online.target
[Service]
Type=simple
User=pi
WorkingDirectory=/home/pi/autossh
ExecStart=/home/pi/autossh/script.sh
@ardinusawan
ardinusawan / README.md
Last active February 22, 2023 07:02
JWE using JOSE with EdDSA algorithm in NodeJS

JWS & JWT using JOSE

How

  1. npm i jose

JWE using alg dir and A128GCM enc

node jwe.js

JWS using alg EdDSA and ed25519 enc