Skip to content

Instantly share code, notes, and snippets.

View wuriyanto48's full-sized avatar

wuriyanto wuriyanto48

View GitHub Profile
@wuriyanto48
wuriyanto48 / a.txt
Created November 1, 2023 13:05
Stop Global Protect MacOs Monterey
sudo sed -i '' -e "s/true/false/g" /Library/LaunchAgents/com.paloaltonetworks.gp.pangpa.plist
@wuriyanto48
wuriyanto48 / main.py
Created October 25, 2023 13:14
Google Search Python
import requests
import json
api_key = ""
cx = ""
query = "pertamina berita"
url = f"https://www.googleapis.com/customsearch/v1?key={api_key}&cx={cx}&q={query}"
response = requests.get(url)
data = json.loads(response.text)
@wuriyanto48
wuriyanto48 / index.js
Last active September 11, 2023 08:51
[NodeJs] RSA Digital signature to PDF file with QRCODE
const fs = require('fs');
const qrcode = require('qrcode');
const { rsa, rsaSign } = require('crypsi');
const { PDFDocument } = require('pdf-lib');
const main = () => {
return new Promise((resolve, reject) => {
const privateKeyData = fs.readFileSync('private_key_pkcs8.key');
const publicKeyData = fs.readFileSync('public.key');
const pdfBuffer = fs.readFileSync('pdf_file.pdf');
@wuriyanto48
wuriyanto48 / main.py
Created March 13, 2023 04:27
Python: Fetch Google Analytic 4 data with google-analytics data module
import os
import json
from google.analytics.data_v1beta import BetaAnalyticsDataClient
from google.analytics.data_v1beta.types import (
DateRange,
Dimension,
Metric,
RunReportRequest,
)
@wuriyanto48
wuriyanto48 / index.js
Created March 13, 2023 04:26
Nodejs: Fetch Google Analytic 4 data with google-analytics/data module
const { BetaAnalyticsDataClient } = require('@google-analytics/data');
const PROPERTY_ID = '292104555';
const analyticsDataClient = new BetaAnalyticsDataClient({
keyFile: 'credentials.json'
});
// Runs a simple report.
async function runReport() {
@wuriyanto48
wuriyanto48 / index.js
Created March 13, 2023 03:58
Big Query Nodejs example
'use strict';
function main() {
const projectId = 'project-name';
const datasetId = 'my_dataset';
const tableId = 'animals';
const datasetLocation = 'asia-southeast2';
// [START bigquery_client_json_credentials]
@wuriyanto48
wuriyanto48 / README.md
Created March 9, 2023 08:14
Vagrant WSL

This is caused when VAGRANT_WSL_ENABLE_WINDOWS_ACCESS environment variable is not set.

First Export Environment Variables

export VAGRANT_WSL_ENABLE_WINDOWS_ACCESS="1"
export PATH="${PATH}:/mnt/c/Program Files/Oracle/VirtualBox"

Run Vagrant using following commands

@wuriyanto48
wuriyanto48 / main.go
Last active February 14, 2023 06:15
Golang os/exec: execute df command
package main
import (
"fmt"
"io"
"os"
"os/exec"
"regexp"
"strings"
"encoding/json"
@wuriyanto48
wuriyanto48 / Pbkdf2.java
Last active December 26, 2024 18:35
Keycloak Password Hash Implementation in Golang and Java
package com.wuriyanto.pbkdf2;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.PBEKeySpec;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import java.security.SecureRandom;
import java.security.spec.InvalidKeySpecException;
import java.util.Arrays;
@wuriyanto48
wuriyanto48 / convert.py
Created February 7, 2023 05:29
Python: convert oneline RSA key to multiline with Header
#!/usr/bin/env python
import sys
def main():
argc = len(sys.argv)
if argc < 3:
print("required keyfile and type")
print("eg: ./convert.py private.key private")
sys.exit(1)