Skip to content

Instantly share code, notes, and snippets.

View aelloc's full-sized avatar
🦀

ь aelloc

🦀
View GitHub Profile
@aelloc
aelloc / battery.rs
Created February 15, 2026 13:16
Random Rust snippet
use regex::Regex;
use std::fs;
use std::path::Path;
fn main() {
let _ = get_battery_path();
let p = get_battery_percentages();
let s = get_battery_status();
println!("{:?}", p);
@aelloc
aelloc / install.sh
Created March 8, 2025 02:09
install.sh
#!/bin/bash
# EndeavourOS Package Installer Script
# Created on March 8, 2025
echo "Starting installation of packages..."
# Update system first
sudo pacman -Syyu
@aelloc
aelloc / envread.go
Created March 21, 2024 12:07
My own .env reader function.
package utils
import (
"fmt"
"os"
"strings"
)
func ReadENV(key string) (value string) {
var result string
@aelloc
aelloc / bot.ts
Created February 20, 2024 11:48
Bot
import { MyContext, MyConversation } from "../config/bot.ts";
import { createConversation } from "https://deno.land/x/grammy_conversations@v1.2.0/conversation.ts";
import { bot } from "../config/index.ts";
import { InlineKeyboard } from "../deps.ts";
const kv = await Deno.openKv()
const ADMIN = "5317740617"
const GROUP = "-4124723873"
async function meme(conversation: MyConversation, ctx: MyContext) {
@aelloc
aelloc / http_request.go
Created January 21, 2024 03:59
Read dynamic or unknown JSON response.
package main
import (
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
@aelloc
aelloc / may
Created October 25, 2023 11:17
May(Umar Hayyom)
Bir qo'lda Qur'onu bittasida jom,
Ba'zida halolmiz, ba'zida harom,
Feruza gumbazli osmon ostida
Na chin musulmonmiz, na kofir tamom.
Men keldimu, dunyo ko'rdimi foyda?
Ketsam martabasi osharmi? Qayda!
Hech kim tushuntirib bera olmadi:
Kelishim - ketishim sababi qayda.
@aelloc
aelloc / color.ts
Created October 17, 2023 03:04
Some colors to use on CLI app with Deno.
export default {
"red": "\x1b[31m%s\x1b[0m",
"blue": "\x1b[36m%s\x1b[0m",
"purple":"\x1b[35m%s\x1b[0m",
"green":"\x1b[32m%s\x1b[0m",
"yellow":"\x1b[33m%s\x1b[0m",
}
use std::{
env,
fs::{self, File},
path::Path,
};
pub fn config() {
let config_path = format!(
"/home/{}/.xonfig/",
env::var("LOGNAME").unwrap_or(".config".to_owned())
{
"workbench.colorTheme": "JetBrains Darcula Theme",
"editor.fontFamily": "'jetbrains mono', monospace",
"editor.fontSize": 20,
"window.zoomLevel": 1
}
@aelloc
aelloc / nums.ts
Last active March 16, 2023 15:02
function sums(nums: number[]): {odds: number, evens: number} {
let odds: number = 0
let evens: number = 0
for(let num of nums) {
if(num%2==0) evens += num;
else odds += num;
}
return { odds, evens };