Skip to content

Instantly share code, notes, and snippets.

View dinkopehar's full-sized avatar
📡
Houston, we have a problem

Dinko Pehar dinkopehar

📡
Houston, we have a problem
View GitHub Profile
@dinkopehar
dinkopehar / music-editor.rb
Created May 29, 2023 08:55
Script to add ID3 tags to .mp3 files for my car
require 'id3tag'
require 'pathname'
require 'fileutils'
MUSIC_FOLDER = Pathname.new('./music')
# Get all MP3 files.
songs = Dir.entries(MUSIC_FOLDER).select { |song| song.end_with? '.mp3' }
# Read each file ID3 tag.
@dinkopehar
dinkopehar / escpos_play.py
Created July 21, 2020 09:00
Custom script to download cat images and print them using ESCPOS mode
import shutil
from escpos.printer import Usb
import requests
from PIL import Image
def download_cat_image(status_code=200):
"""Download cat image based on status_code."""
@dinkopehar
dinkopehar / intruder.sh
Created July 19, 2020 21:21
Screenshot intruder with ffmpeg, show his face to him and lock the session
ffmpeg -y -i /dev/video0 -vframes 1 -q:v 2 ~/output.jpg
gwenview -f ~/output.jpg &
sleep 2
loginctl lock-session
@dinkopehar
dinkopehar / ssh_without_password.sh
Created July 19, 2020 21:20
Copy your public key to remote machine for ssh without password
#!/usr/bin/env bash
### Script to store ssh_key on remote machine.
### No prompt for password :)
# Replaced with ssh-copy-id :shrug:
if [[ "$#" -ne 1 ]]; then
echo "Interactive help:"
echo "-----------------"
echo " --- Script to store public ssh key to remote machine ---"
@dinkopehar
dinkopehar / vim_commands.md
Last active November 17, 2018 11:19
Some Vim commands that I learned through VSCode Vim extension and Extensions for VSCode

Vim commands to know AND EXTENSIONS FOR VSCODE.

Edit:

  • i and a for insert mode
  • I and A for insert to begin/end
  • o and O for insert new line below/above

Moving Commands

  • {n}G or :{n} for moving to specified line
  • 0 for moving to beginning of current line
@dinkopehar
dinkopehar / settings.json
Last active March 23, 2019 07:36
Visual Studio Code custom settings, mainly for python
{
"editor.fontSize": 20,
"editor.minimap.enabled": true,
"editor.fontLigatures": true,
"editor.fontFamily": "'Dank Mono','Fira Code','Anonymous Pro', Consolas, 'Courier New', monospace",
"editor.cursorBlinking": "blink",
"editor.smoothScrolling": true,
"editor.lineHeight": 34,
"editor.renderWhitespace": "none",
"editor.renderControlCharacters": false,
@dinkopehar
dinkopehar / cyclic.py
Last active November 16, 2018 09:22
cyclic
def create_emtpy_cyclic_array(rows = 3, columns = 3):
matrix = []
for i in range(rows):
row_array = []
for j in range(columns):
row_array.append(" x ")
matrix.append(row_array)