Skip to content

Instantly share code, notes, and snippets.

View abrahammurciano's full-sized avatar
🐧

Abraham Murciano abrahammurciano

🐧
  • Jerusalem
View GitHub Profile
@abrahammurciano
abrahammurciano / yay-config.json
Created August 4, 2023 15:12
Configuration for yay with minimal intervention. ~/.config/yay/config.json
{
"aururl": "https://aur.archlinux.org",
"aurrpcurl": "https://aur.archlinux.org/rpc?",
"buildDir": "/home/abraham/.cache/yay",
"editor": "",
"editorflags": "",
"makepkgbin": "makepkg",
"makepkgconf": "",
"pacmanbin": "pacman",
"pacmanconf": "/etc/pacman.conf",
@abrahammurciano
abrahammurciano / serve
Created May 28, 2023 20:01
Start a webserver serving a directory
#/usr/bin/env bash
folder=${1:-$(pwd)}
ip_address=$(ip a | grep -E '[0-9]+: w[a-z0-9]+:' -A2 | grep 'inet ' | cut -d' ' -f6 | cut -d/ -f1)
port=${2:-$(( 8001 + RANDOM % (9000 - 8001 + 1) ))}
echo "Serving directory $folder on http://$ip_address:$port"
cd $folder
python -m http.server $port
@abrahammurciano
abrahammurciano / .p10k.zsh
Created August 8, 2022 10:50
p10k theme config
# Generated by Powerlevel10k configuration wizard on 2022-08-08 at 13:44 IDT.
# Based on romkatv/powerlevel10k/config/p10k-rainbow.zsh, checksum 15312.
# Wizard options: nerdfont-complete + powerline, small icons, rainbow, unicode,
# 12h time, slanted separators, sharp heads, sharp tails, 2 lines, solid, left frame,
# lightest-ornaments, sparse, many icons, concise, transient_prompt,
# instant_prompt=verbose.
# Type `p10k configure` to generate another config.
#
# Config for Powerlevel10k with powerline prompt style with colorful background.
# Type `p10k configure` to generate your own config based on it.
@abrahammurciano
abrahammurciano / bash-python.shpy
Last active March 23, 2022 12:55
Is this bash or python? Yes.
#!/usr/bin/env bash
""""\
export LAUNCHED_WITH_BASH=true
echo this is bash
echo args: "$0" "$@"
python3.7 "$0" "$@"
exit $?
"""
import os
@abrahammurciano
abrahammurciano / what
Created February 16, 2022 21:32
Linux script that routes to ls, cat, or less, depending on the input path
#!/usr/bin/env bash
LINES=${LINES:-$(tput lines)}
if [[ -d "$1" || -z "$1" ]]; then
ls -lhF --color=always "${1:-$(pwd)}"
elif [[ $(head -n $LINES "$1" | wc -l) -eq $LINES ]]; then
less -N "$1"
else
cat "$1"
@abrahammurciano
abrahammurciano / config.py
Created February 16, 2022 21:26
My ptpython settings
from prompt_toolkit.filters import ViInsertMode
from prompt_toolkit.key_binding.key_processor import KeyPress
from prompt_toolkit.keys import Keys
from prompt_toolkit.styles import Style
from ptpython.layout import CompletionVisualisation
__all__ = ["configure"]
#!/bin/bash
all_devices=$(pacmd list-sinks | grep "index" | awk 'NF>1{print $NF}' | tr '\n' ' ')
current_device=$(pacmd list-sinks | grep "* index" | awk 'NF>1{print $NF}')
found=false
# set next_device to first device
next_device=$(echo $all_devices | cut -d " " -f1)
# set next_device to device after current_device (if it exists)
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<profiles version="1">
<profile kind="CodeFormatterProfile" name="Abraham" version="1">
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.disabling_tag" value="@formatter:off"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="end_of_line"/>
disk_path=/home/abraham/vm/qemu/win/disk
webcam_bus=$(lsusb | grep -i cam | awk '{print $2}')
webcam_dev=$(lsusb | grep -i cam | awk '{print substr($4, 1, length($4)-1)}')
# change permissions for webcam
sudo chmod a+w /dev/bus/usb/$webcam_bus/$webcam_dev
# launch command
qemu-system-x86_64 -m 4096 -enable-kvm -drive file=$disk_path,format=raw -cpu host -smp cores=$(nproc) -vga virtio -device sb16 -device ES1370 -device AC97 -device adlib -device gus -device cs4231a -device intel-hda -device hda-duplex -usb -device usb-ehci,id=ehci -device usb-host,hostbus=$webcam_bus,hostaddr=$webcam_dev
@abrahammurciano
abrahammurciano / Execute_Order_66.js
Last active May 20, 2020 08:18
Execute Order 66 on Rotten Tomatoes Summer Movie Showdown of 2020. Run this script on their site https://editorial.rottentomatoes.com/article/summer-movie-showdown/ to keep voting for Star Wars! Good Soldiers Follow Orders!
if(typeof jQuery=='undefined') {
var headTag = document.getElementsByTagName("head")[0];
var jqTag = document.createElement('script');
jqTag.type = 'text/javascript';
jqTag.src = '//ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js';
jqTag.onload = execute;
headTag.appendChild(jqTag);
} else {
execute()
}