Skip to content

Instantly share code, notes, and snippets.

View filviu's full-sized avatar

Silviu Vulcan filviu

View GitHub Profile
@filviu
filviu / 90-kensington-expert-trackball-remap.hwdb
Last active April 25, 2024 07:06 — forked from dnlvgl/90-kensington-expert-trackball-remap.hwdb
Remapping Kensington Expert Trackball Buttons with wayland
# Button remap for Kensington Expert Wireless Trackball to:
# BACK MIDDLE
# O
# LEFT RIGHT
# save this file under '/etc/udev/hwdb.d/90-kensington-expert-trackball-remap.hwdb'
# run `sudo systemd-hwdb update` and reboot
#
# source: https://askubuntu.com/questions/1145057/remapping-mouse-buttons-to-keyboard-keys
# and: https://gist.github.com/dnlvgl/d16fd822bc90dcdaaae262a76fad884e
#

On CentOS 7, the last command doesn't support the --since option to filter users who have logged in within the past two weeks. However, you can use some other commands and scripts to achieve this. Here's a Bash script that can help you find users who have logged in within the past two weeks.

Save this script to a file, for example, show_recent_logins.sh, and make it executable with the following command:

chmod +x show_recent_logins.sh

Then, you can run the script to display users who have logged in within the past two weeks.

@filviu
filviu / README.md
Last active July 11, 2023 14:13
Karabiner / Synergy Integration
  • Add ~/bin/synergy-karabiner.sh to General -> Login Items

Do note that if you sleep and resume on a new wifi network the script is still running. I should really implement a python mini-daemon for this :)

The script calls on two profiles:

  • mac which has all my customizations
  • disabled a blank profile with no customizations

Notes:

@filviu
filviu / gist:5ba69474cfbd31c7d20d339bf3a983a9
Created March 31, 2023 05:31
Multiple 9p folder mounts with proxmox
In `/etc/pve/qemu-server/NNN.conf`
```
args: -fsdev local,security_model=passthrough,id=fsdev0,path=/some/path/folder1 -device virtio-9p-pci,id=fs0,fsdev=fsdev0,addr=0x4,mount_tag=9p_folder1 -fsdev local,security_model=passthrough,id=fsdev1,path=/some/path/folder2 -device virtio-9p-pci,id=fs1,fsdev=fsdev1,addr=0x1a,mount_tag=folder2
```
Then inside the VM inside `/etc/fstab`
```
folder1 /mnt/folder1 9p trans=virtio,rw,_netdev,nobootwait 0 0
@filviu
filviu / .bashrc-bookmarks
Last active March 31, 2023 05:17
Shell bookmarks in bash
#!/bin/bash
if [ -d "$HOME/.bookmarks" ]; then
export CDPATH=".:$HOME/.bookmarks:/"
alias {g,go,goto}="cd -P"
_goto()
{
local IFS=$'\n'
COMPREPLY=( $( compgen -W "$(/bin/ls ~/.bookmarks)" -- ${COMP_WORDS[COMP_CWORD]}))
} && complete -F _goto goto go g
@filviu
filviu / cloud-init.cfg
Created March 14, 2023 13:07 — forked from berkant/cloud-init.cfg
Cloud-init config to set up my Ubuntu dev machine.
## template: jinja
#cloud-config
{% if v1.distro_release == 'focal' %}
users:
- name: berkant
shell: /usr/bin/bash
ssh_import_id: gh:berkant
sudo: ALL=(ALL:ALL) NOPASSWD:ALL
@filviu
filviu / openssl-notes.txt
Created January 28, 2022 11:16 — forked from tsaarni/openssl-notes.txt
Generate self-signed certs with different key types
*** RSA
# Generate self-signed certificate with RSA 4096 key-pair
openssl req -x509 -nodes -days 3650 -newkey rsa:4096 -keyout rsakey.pem -out rsacert.pem
# print private and public key
openssl rsa -in rsakey.pem -text -noout
# print certificate
openssl x509 -in rsacert.pem -text -noout
@filviu
filviu / ps.sh
Created November 2, 2021 11:49
Process uptime
ps -eo comm,etime,user | grep PROCESS
@filviu
filviu / Microsoft.PowerShell_profile.ps1
Last active November 2, 2021 11:50
Powershell CTRL+D to exit terminal.
# drop in Documents\WindowsPowerShell
# Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
Set-PSReadlineKeyHandler -Key ctrl+d -Function ViExit
@filviu
filviu / n800-video.sh
Created November 2, 2021 11:15
Options for mplayer on Nokia N800 to get decent playback. Last time checked ~2012
mplayer -lavdopts lowres=1 <videofile>
mplayer quiet-file -af volume=10