Skip to content

Instantly share code, notes, and snippets.

@CommanderAsdasd
CommanderAsdasd / config-lsp-jedi.el
Last active April 3, 2024 23:27
emacs python lsp-jedi
;; pip install jedi-language-server
(use-package lsp-mode
:init
(setq lsp-keymap-prefix "C-c l")
:config
(setq lsp-idle-delay 0.5
lsp-enable-symbol-highlighting t
lsp-warn-no-matched-clients t)
:hook ((python-mode . lsp)
@CommanderAsdasd
CommanderAsdasd / raw_video.sh
Last active December 30, 2023 02:11
play random file as raw video, encode to mp4
./mplayer.exe -demuxer rawvideo -rawvideo w=640:h=320 $file
# Limiting time with -t 10 for big files, remove for full
ffmpeg -f rawvideo -pixel_format yuv420p -video_size 640x320 -i $file -c:v libx264 -preset slow -crf 22 -t 10 `basename $file`.mp4
@CommanderAsdasd
CommanderAsdasd / sort-files.el
Created May 20, 2023 13:30
elisp sort list of files in dir in > alphabetical order
(sort (directory-files "C:\\") #'string>)
@CommanderAsdasd
CommanderAsdasd / delete-all-backups.el
Created November 29, 2022 13:19
delete all backup files emacs
;; delete all backup files in the current directory - starting with .# or ending with ~
;; use file-expand-wildcards for *~
(defun get-backup-files ()
(append (file-expand-wildcards "./*~")
(file-expand-wildcards "./#*#")
(file-expand-wildcards "./.#*"))) ;
;; print backup files interactively
(defun print-backup-files ()
@CommanderAsdasd
CommanderAsdasd / js-glsl-polymode-config.el
Last active July 31, 2022 14:13
describe js hostmode with multiline glsl injections
(use-package polymode
:config)
(define-innermode poly-js-glsl-innermode
:mode 'glsl-mode
:head-matcher (rx "\`" (+ alnum))
:tail-matcher (rx (* alnum) "\`")
:head-mode 'host
:tail-mode 'host)
@CommanderAsdasd
CommanderAsdasd / install_ruby.sh
Created April 12, 2022 11:44
Install ruby on RHEL 8 (goofy...)
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
exec $SHELL
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
exec $SHELL
@CommanderAsdasd
CommanderAsdasd / popup-tip-at-point.el
Last active March 31, 2022 00:23
descibe function at point with popup
(defun asdasd-popup-describe-function ()
(interactive)
(popup-tip (documentation (symbol-at-point)) :around t))
@CommanderAsdasd
CommanderAsdasd / asdasd-var-value.el
Created February 21, 2022 16:30
Elisp printing symbol value at point
;; I prepend functions defined myself with asdasd-* to fuzzy search them then - keep forgetting what I've already developed :)
(defun asdasd-var-value ()
(interactive)
(pp (symbol-value (car (read-from-string (thing-at-point 'symbol))))))
(global-set-key (kbd "C-c C-v") 'asdasd-var-value)
@CommanderAsdasd
CommanderAsdasd / ffmpeg-send-audio.sh
Last active April 11, 2022 18:34
Stream audio over local network with ffmpeg from linux machine to windows
# sender
# you can find device name via `pactl list short sources`:
ffmpeg -f pulse -i "alsa_output.pci-0000_00_1f.3.analog-stereo.monitor" -ac 2 -acodec pcm_u8 -ar 48000 -f u8 "udp://10.0.0.8:18181"
# on reciever does:
ffplay.exe -nodisp -ac 2 -acodec pcm_u8 -ar 48000 -analyzeduration 0 -probesize 32 -f u8 -i udp://0.0.0.0:18181?listen=1
@CommanderAsdasd
CommanderAsdasd / seconds_to_timestamp.py
Created February 10, 2022 11:51
python get time from seconds to HH:MM:SS
import time
time.strftime('%H:%M:%S', time.gmtime(120))