Skip to content

Instantly share code, notes, and snippets.

View wuriyanto48's full-sized avatar

wuriyanto wuriyanto48

View GitHub Profile
@wuriyanto48
wuriyanto48 / minio.conf
Created March 21, 2024 17:11
minio nginx conf
server {
listen 443 ssl;
server_name storage.mydomain.co;
# ssl
ssl_certificate /home/ubuntu/ssl/storage.mydomain.co/server.crt;
ssl_certificate_key /home/ubuntu/ssl/storage.mydomain.co/server.key;
# To allow special characters in headers
ignore_invalid_headers off;
@wuriyanto48
wuriyanto48 / README.md
Created February 7, 2024 18:34
sudo: no valid sudoers sources found, quitting

You can bind the /etc volume into docker like that:

docker run -it --rm -v /etc:/etc_host ubuntu bash

You gained root access. Then you can change the permissions of /etc_host/sudoers to 777:

chmod 777 /etc_host/sudoers
@wuriyanto48
wuriyanto48 / a.md
Created January 6, 2024 12:15
install pytorch

Install pytorch CPU only

pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu

Install pytorch GPU

pip3 install torch torchvision torchaudio
@wuriyanto48
wuriyanto48 / main.py
Created November 30, 2023 13:50
(Python) Gitlab REST API get commit by user
import requests
import ujson as json
header ={
'PRIVATE-TOKEN': 'your_token'
}
def get_commits_by_user(project_id, email, since, until, branch):
json_loads_of_commit = []
params = {
"since": since,
@wuriyanto48
wuriyanto48 / main.go
Created November 30, 2023 13:44
Google Text To Speech
package main
import (
"fmt"
"io"
"net/http"
"net/url"
"os"
)
@wuriyanto48
wuriyanto48 / main.js
Last active November 15, 2023 06:36
convert JSON to .env file
const readline = require('readline');
const fs = require('fs');
const path = require('path');
// this function will convert json file to .env
// USAGE:
// => node ./scripts/json_to_env.js env.json
function main() {
const args = process.argv;
if (args.length <= 2) {
@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,
)