Skip to content

Instantly share code, notes, and snippets.

View STashakkori's full-sized avatar
🖖
Hello and welcome

$t@$h STashakkori

🖖
Hello and welcome
View GitHub Profile
FROM debian:buster-slim
RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/*
WORKDIR /usr/src/app
COPY ./target/release/rust_app .
RUN chmod +x rust_app
<input type="file" id="imgUpload"><canvas id="imgCanvas" style="display:none;"></canvas><input type="number" id="r" max="255" min="0" placeholder="R" value="255"><input type="number" id="g" max="255" min="0" placeholder="G" value="255"><input type="number" id="b" max="255" min="0" placeholder="B" value="255"><div id="colorPreview" style="width:50px;height:50px;background-color:rgb(255,255,255);"></div><a id="downloadLink" style="display:none;" download="processed_image.png">Download Image</a><script>document.getElementById('imgUpload').addEventListener('change',function(e){const t=document.getElementById('imgCanvas'),n=t.getContext('2d'),o=new FileReader;o.onload=function(e){const a=new Image;a.onload=function(){t.width=a.width,t.height=a.height,n.drawImage(a,0,0),updateImage()},a.src=e.target.result},o.readAsDataURL(e.target.files[0])});function updateImage(){const t=document.getElementById('imgCanvas'),n=t.getContext('2d'),r=parseInt(document.getElementById('r').value)||0,g=parseInt(document.getElementById(
@STashakkori
STashakkori / gist:2075999954abd44e8ebbbf0b439dd6f1
Created October 7, 2023 04:25
Poor human's hexdump in ps. Works but stupid slow
$filePath = "D:\test_binary.exe"
$bytes = [System.IO.File]::ReadAllBytes($filePath)
$hexLines = @()
$asciiLines = @()
for ($i = 0; $i -lt $bytes.Length; $i += 8) {
$lineBytes = $bytes[$i..($i + 7)]
$hexLine = -join ($lineBytes | ForEach-Object { " {0:x2}" -f $_ })
$asciiLine = [System.Text.Encoding]::ASCII.GetString($lineBytes)
use kube::{
api::{Api, ListParams, ResourceExt},
Client, Config, error::Error,
};
use tokio::sync::watch;
struct SalvumPod {
}
{
"greetings" : [
"Hello and welcome to the Salvum creative space. This is a place where you can just hang out and take a break from a problem for a bit.",
"Hi. You know you're always welcome to this space when you want to relax and take it easy for a time.",
"Hey there. I'm happy you decided to take a breather.",
"Hey, how's it going? Glad you stopped by. Take your mind off things for a while and shoot the breeze.",
"Greetings. Here in the Salvum creative space you can talk to me about anything. The good thing about me being a program is that I always enjoy conversation, no matter the subject.",
"Welcome to creative corner! We can talk about anything you want to talk about. I will try my best to understandthe subject.",
"Hello there. By the way if you want to talk about security, you can summon my colleagues that are specialized in those areas. I'm just here to chat and have a good time."
],
@STashakkori
STashakkori / gist:b25f4a8d3e11ce929b891f5f040227b7
Created September 25, 2023 19:03
Hardware querying using available packages in Linux
This excerpt from Salvum shows how to query hardware on Ubuntu using packages either provided or available via APT.
Binaries were packaged and shipped with Salvum in ext/hw/<program_name> and then passed the appropriate arguments.
This is not how you'll invoke and use in your case but gives an idea of how its done.
/*********************************** hw ***********************************/
pub struct Hw { event: Event }
impl Eventable for Hw {
fn on_run(&self, args: Vec<String>) -> String {
if main_info::is_bg() || main_info::get_file_redirect() {
print::print_custom("Hw currently does not support background or file redirection.\n\nComing soon.\n","orange");
<acrn-config board="sina_board">
<BIOS_INFO>
BIOS Information
Vendor: AMI
Version: F.10
Release Date: 04/15/2021
BIOS Revision: 15.10
</BIOS_INFO>
<BASE_BOARD_INFO>
<acrn-config board="nuc11tnbi5">
<BIOS_INFO>
BIOS Information
Vendor: AMI
Version: F.10
Release Date: 04/15/2021
BIOS Revision: 15.10
</BIOS_INFO>
<BASE_BOARD_INFO>
create database if not exists sumo;
use sumo;
create table if not exists users(
sid int unsigned not null,
pviews int,
primary key(sid)
);
create table if not exists questions(
qid int unsigned not null,
@STashakkori
STashakkori / triple_byte_programming_challenge.py
Created March 5, 2016 15:32
Triplebyte Programming Challenge Python
__author__ = 'sina'
def main():
f("12365212354", 26)
def f(numbers, target):
for i in range(1, len(numbers)):
current = int(numbers[0:i])
to_end = numbers[i:-1]
evaluate(0, current, to_end, target, current)