Skip to content

Instantly share code, notes, and snippets.

View wuriyanto48's full-sized avatar

wuriyanto wuriyanto48

View GitHub Profile
@wuriyanto48
wuriyanto48 / index.js
Last active July 24, 2024 09:33
AES Gcm Encryption (Pair Golang, PHP and NodeJs)
const crypto = require('crypto');
const ALGORITHM = 'aes-256-gcm';
class AESGcmNode {
constructor(key) {
if (key.length < 32) {
throw new Error("key len should be 32 byte");
}
this.key = Buffer.from(key);
@wuriyanto48
wuriyanto48 / README.md
Created December 2, 2021 04:30 — forked from nmarley/README.md
Go / C++ bindings example

Go / C++ bindings example

This is an example of Go code calling to a C++ library with a C wrapper.

Build

go build  # this only ensures it compiles
@wuriyanto48
wuriyanto48 / README.md
Created November 28, 2021 09:42
/usr/bin vs /usr/local/bin
  • /bin (and /sbin) were intended for programs that needed to be on a small / partition before the larger /usr, etc. partitions were mounted. These days, it mostly serves as a standard location for key programs like /bin/sh, although the original intent may still be relevant for e.g. installations on small embedded devices.

  • /sbin, as distinct from /bin, is for system management programs (not normally used by ordinary users) needed before /usr is mounted.

  • /usr/bin is for distribution-managed normal user programs.

  • There is a /usr/sbin with the same relationship to /usr/bin as /sbin has to /bin.

  • /usr/local/bin is for normal user programs not managed by the distribution package manager, e.g. locally compiled packages. You should not install them into /usr/bin because future distribution upgrades may modify or delete them without warning.

@wuriyanto48
wuriyanto48 / README.md
Created November 25, 2021 02:54
Download file with Python and Paramiko SSH Client

You need to install paramiko package

$ pip install paramiko
@wuriyanto48
wuriyanto48 / install.md
Last active November 23, 2021 08:11
Install Apache Spark on Ubuntu
@wuriyanto48
wuriyanto48 / ftp_d.py
Last active November 9, 2021 17:05
Download file From FTP Server with Python
import ftplib
import socket
from pathlib import Path
class MyFTP_TLS(ftplib.FTP_TLS):
"""Explicit FTPS, with shared TLS session"""
def ntransfercmd(self, cmd, rest=None):
conn, size = ftplib.FTP.ntransfercmd(self, cmd, rest)
if self._prot_p:
conn = self.context.wrap_socket(conn,
@wuriyanto48
wuriyanto48 / csr.md
Created October 27, 2021 17:37
How to Manually Generate CSR using OpenSSL

Generate Private Key

$ openssl genrsa -out private.key 2048

Generate CSR with Private Key and fill the required fields

$ openssl req -new -key private.key -out csr.txt
@wuriyanto48
wuriyanto48 / main.go
Created October 25, 2021 04:09
Random Pixel formula Genarator with Go
// wuriyanto
package main
import (
"fmt"
"math/rand"
//"time"
)
type Color struct {
@wuriyanto48
wuriyanto48 / main.py
Last active April 9, 2022 17:40
Get Network value from IP with Python
def encode_uint32(n: int):
res = []
for i in range(4):
r_shift = 24 - 8 * i
d = (n >> r_shift) & 0xFF
res.append(d)
return res
def decode_uint32(l: list, order='be'):
if order == 'le':
@wuriyanto48
wuriyanto48 / main.go
Created October 2, 2021 09:49
Golang check if number is Odd with (Bitwise AND)
package main
import (
"fmt"
)
func main() {
fmt.Println(isOdd(2))
}