Skip to content

Instantly share code, notes, and snippets.

View sovietspy2's full-sized avatar
💩
will code for food

Barney Dono sovietspy2

💩
will code for food
View GitHub Profile
@sovietspy2
sovietspy2 / zed_settings.json
Created October 5, 2024 15:02
My zed editor custom settings
// Zed settings
//
// For information on how to configure Zed, see the Zed
// documentation: https://zed.dev/docs/configuring-zed
//
// To see all of Zed's default settings without changing your
// custom settings, run `zed: open default settings` from the
// command palette (cmd-shift-p / ctrl-shift-p)
{
"assistant": {
@sovietspy2
sovietspy2 / machinespirit.sh
Created September 15, 2024 12:09
LLM based terminal that accept natural language commands
#!/bin/bash
printf "\033[91m⚙\033[0m ~ \033[97mTERMINAL\033[0m ~ \033[91m⚙\033[0m:\033[92mPRAY TO THE MACHINE SPIRIT!\033[0m"
echo ""
sleep 2
text_param="$*"
tgpt -shell -y "$text_param"
# install: put this file to /usr/local/bin then chmod +x machinespirit
# usage: machinespirit Tell me the current time!
@sovietspy2
sovietspy2 / delete_exited_containers.sh
Created May 13, 2024 15:09
Bash script to delete all exited docker containers
#!/bin/bash
# List all exited Docker containers
exited_containers=$(docker ps -a -f status=exited -q)
# Iterate over each exited container ID
for container_id in $exited_containers; do
echo "Deleting exited container: $container_id"
docker rm $container_id
done
@sovietspy2
sovietspy2 / sound_control.sh
Created May 7, 2024 17:19
Thinkpad T480 change audio output between BUILT IN SPEKER and HDMI
#!/bin/bash
# Define the card and its profiles
CARD="pci-0000_00_1f.3"
CARD_PROFILE_1="hdmi-stereo" # Profile 1
CARD_PROFILE_2="analog-stereo" # Profile 2
CURRENT_PROFILE=$(pacmd list-sinks | awk '/^\s*\* index:/{flag=1; next} flag && /active port:/{print $NF; exit}')
echo $CURRENT_PROFILE
# Function to set the profile based on the argument
@sovietspy2
sovietspy2 / venv.sh
Created November 12, 2023 14:34
create venv in current directory or activate venv is present
#!/bin/bash
# Define the name for the virtual environment
venv_name="venv"
# Check if the virtual environment already exists
if [ -d "$venv_name" ]; then
echo "Activating existing virtual environment..."
source "$venv_name/bin/activate"
else
@sovietspy2
sovietspy2 / Main.java
Last active September 28, 2023 14:33
much java so safe
package org.example.inheritance;
import java.lang.reflect.Field;
public class Main2 {
public static void main(String[] args) {
Child child = new Child();
@sovietspy2
sovietspy2 / aws.md
Created December 23, 2022 09:25
how to aws networking

AWS

VPC

define network

Subnet

  • by defautl every subnet is private
  • add NAT to public subnet
  • attach IGW to public subnet
  • enable auto elastic ip assignment for public subnet
@sovietspy2
sovietspy2 / file.java
Created August 18, 2022 14:37
Java stuff
Map<Integer,Integer> map = new HashMap<Integer,Integer>();
for (Integer i : arr) {
// MAP COMPUTE EXAMPLE
map.compute(i, (key,val) -> {
if (val==null) {
return 0;
} else {
return val+1;
}
@sovietspy2
sovietspy2 / docker-compose.yml
Created October 28, 2021 14:33
Kafka+Zookeeper+KafkaDrop
version: '2'
services:
zookeeper:
image: wurstmeister/zookeeper
ports:
- "2181:2181"
kafka:
image: wurstmeister/kafka
ports:
@sovietspy2
sovietspy2 / show_nginx_modules.sh
Created August 30, 2021 13:48
This will list all enabled modules of nginx service
nginx -V 2>&1 | tr ' ' '\n'