Skip to content

Instantly share code, notes, and snippets.

View xsnpdngv's full-sized avatar

Tamás Dezső xsnpdngv

View GitHub Profile
@xsnpdngv
xsnpdngv / product_number_validator.vba
Created July 17, 2024 09:24
Checks if a string value is a valid product number matching a regex
Function IsValidValue(value As String, minLength As Integer, maxLength As Integer) As Boolean
Dim regex As Object
Set regex = CreateObject("VBScript.RegExp")
' Define the pattern to match the conditions:
' - Starts with one or more digits
' - Followed by zero or more letters
' - Only alphanumeric characters are allowed
regex.Pattern = "^\d+[a-zA-Z]*$"
regex.IgnoreCase = False
@xsnpdngv
xsnpdngv / keybindings.json
Created December 2, 2020 15:52
VSCode keybinding to switch between terminals
// Place your key bindings in this file to override the defaults
[
{
"key" : "shift+right", //"ctrl+down" is not working
"command": "workbench.action.terminal.focusNext",
"when" : "terminalFocus",
},
{
"key" : "shift+left", //"ctrl+up" is not working
"command": "workbench.action.terminal.focusPrevious",
@xsnpdngv
xsnpdngv / CMakeLists.txt
Last active February 29, 2020 20:01
Useful C++ compile flags
add_compile_options(-Wall
-Wextra
-pedantic
-Werror
-Wunitialized / -Wmaybe-uninitialized
-Wnon-virtual-dtor
-Weffc++
)
@xsnpdngv
xsnpdngv / off_sh
Created July 20, 2019 12:45
Turn off screen on ubuntu
#!/bin/bash
xset dpms force off
@xsnpdngv
xsnpdngv / ftpsh
Last active November 8, 2017 14:01
FTP bash script
#!/bin/bash
# ============================================================================
# @file ftpsh
# @brief Script to execute command line arguments as FTP command
# @author Tamas Dezso <[email protected]>
# @date November 8, 2017
# ============================================================================
if [ $# -lt 1 ]
then
@xsnpdngv
xsnpdngv / Free O'Reilly Books.md
Created June 20, 2017 22:39 — forked from augbog/Free O'Reilly Books.md
Free O'Reilly Books

Free O'Reilly books and convenient script to just download them.

Thanks /u/FallenAege/ and /u/ShPavel/ from this Reddit post

How to use:

  1. Take the download.sh file and put it into a directory where you want the files to be saved.
  2. cd into the directory and make sure that it has executable permissions (chmod +x download.sh should do it)
  3. Run ./download.sh and wee there it goes. Also if you do not want all the files, just simply comment the ones you do not want.
@xsnpdngv
xsnpdngv / NERDTree.mkd
Created May 5, 2017 08:29 — forked from m3nd3s/NERDTree.mkd
My Vim Cheat Sheet

NERDTree

o.......Open files, directories and bookmarks....................|NERDTree-o|
go......Open selected file, but leave cursor in the NERDTree.....|NERDTree-go|
t.......Open selected node/bookmark in a new tab.................|NERDTree-t|
T.......Same as 't' but keep the focus on the current tab........|NERDTree-T|
i.......Open selected file in a split window.....................|NERDTree-i|
gi......Same as i, but leave the cursor on the NERDTree..........|NERDTree-gi|
s.......Open selected file in a new vsplit.......................|NERDTree-s|
gs......Same as s, but leave the cursor on the NERDTree..........|NERDTree-gs|

O.......Recursively open the selected directory..................|NERDTree-O|

@xsnpdngv
xsnpdngv / imagemagick
Created May 2, 2017 13:36
Convert image to progressive and compressed
convert -strip -interlace Plane -quality 80 input-file.jpg output-file.jpg
@xsnpdngv
xsnpdngv / com.ubuntu.enable-hibernate.pkla
Created May 1, 2017 00:04
Enable hibernate option in Ubuntu: Create or edit under: /etc/polkit-1/localauthority/50-local.d/
[Re-enable hibernate by default in upower]
Identity=unix-user:*
Action=org.freedesktop.upower.hibernate
ResultActive=yes
[Re-enable hibernate by default in logind]
Identity=unix-user:*
Action=org.freedesktop.login1.hibernate;org.freedesktop.login1.handle-hibernate-key;org.freedesktop.login1;org.freedesktop.login1.hibernate-multiple-sessions;org.freedesktop.login1.hibernate-ignore-inhibit
ResultActive=yes
@xsnpdngv
xsnpdngv / cpufreq-sh
Last active September 8, 2020 08:49
Set CPU governor to powersave on Ubuntu
#!/bin/sh
sudo apt-get install cpufrequtils
echo 'GOVERNOR="powersave"' | sudo tee /etc/defaults/cpufrequtils
sudo /etc/init.d/cpufrequtils restart
cpufreq-info