Skip to content

Instantly share code, notes, and snippets.

View mdrokz's full-sized avatar
🎯
Focusing

mdrokz mdrokz

🎯
Focusing
View GitHub Profile
@mdrokz
mdrokz / Dockerfile
Created December 28, 2023 11:41
Custom dockerfile to install extension from pgxn network into postgres
FROM postgres:latest
# FROM debian:latest
# libpq-dev make gcc postgresql postgresql-dev-all
RUN apt-get update && \
apt-get install -y \
python3 \
pipx \
make \
@mdrokz
mdrokz / clone_repos_by_org.sh
Created August 24, 2023 17:40
Bash script to clone all the repos by organization by using the gh graphql API
#!/bin/bash
clone_repos_by_org() {
local orgName="$1"
local numRepos="$2"
local name=$(getReposByOrg "$orgName" "$numRepos" | jq "{nodes: .data.organization.repositories.nodes}")
cd ./repos
@mdrokz
mdrokz / clinfo.txt
Created August 18, 2023 10:02
OPENCL system information
Number of platforms 3
Platform Name Clover
Platform Vendor Mesa
Platform Version OpenCL 1.1 Mesa 23.1.5
Platform Profile FULL_PROFILE
Platform Extensions cl_khr_icd
Platform Extensions function suffix MESA
Platform Name AMD Accelerated Parallel Processing
Platform Vendor Advanced Micro Devices, Inc.
@mdrokz
mdrokz / sync_to_ec2.sh
Created August 17, 2023 20:09
Script to sync ebooks to my EC2 ubooquity server
# Declare the associative array for existing files
declare -A existing_files_map
# Generate log filenames based on the current date and time
skipped_log="logs/skipped_$(date +'%d-%m-%y %H:%M:%S').txt"
uploaded_log="logs/uploaded_$(date +'%d-%m-%y %H:%M:%S').txt"
# Fetch the list of files already present on the EC2 server using find with null delimiter
# and populate the associative array
Computer Information:
Manufacturer: Micro-Star International Co., Ltd.
Model: MPG X570 GAMING EDGE WIFI (MS-7C37)
Form Factor: Desktop
No Touch Input Detected
Processor Information:
CPU Vendor: AuthenticAMD
CPU Brand: AMD Ryzen 7 3800X 8-Core Processor
CPU Family: 0x17
CPU Model: 0x71
@mdrokz
mdrokz / delete_rust_target_folders.sh
Created July 30, 2023 16:44
delete target folders in your dir where you store all of your rust projects
#!/bin/bash
# Check if directory argument is provided
if [ -z "$1" ]; then
echo "Please provide a directory as an argument."
exit 1
fi
# Create an array of directories
dirs=($(ls -d "$1"/*))
@mdrokz
mdrokz / promtail_docker_logs.md
Created July 17, 2023 00:15 — forked from ruanbekker/promtail_docker_logs.md
Docker Container Logging using Promtail
@mdrokz
mdrokz / design_hashset_705.rs
Created May 30, 2023 15:09
Leetcode problem 705 design a hashset implemented in rust
struct MyHashSet {
buckets: Vec<Vec<i32>>,
}
/**
* `&self` means the method takes an immutable reference.
* If you need a mutable reference, change it to `&mut self` instead.
*/
@mdrokz
mdrokz / design_parking_system_1603.rs
Created May 29, 2023 05:22
Leetcode problem 1603 design a parking system implemented in rust
enum CarType {
Big(i32),
Med(i32),
Small(i32)
}
struct ParkingSystem {
big: CarType,
medium: CarType,
small: CarType
@mdrokz
mdrokz / 9_palindrome_number.rs
Created May 29, 2023 04:51
Leetcode problem 9 Palindrome number implemented in rust
impl Solution {
pub fn is_palindrome(x: i32) -> bool {
let y = x.to_string();
let rev = y.chars().rev().collect::<String>();
y == rev
}
}