Skip to content

Instantly share code, notes, and snippets.

View drahosistvan's full-sized avatar

Istvan Drahos drahosistvan

View GitHub Profile
@drahosistvan
drahosistvan / module1.vba
Created May 3, 2024 15:05
VBA beadando - Milton
Sub CalcSales()
'Define main search, currency search and product search variables
Dim currentCell As Range
Dim productCell As Range
Dim currencyCell As Range
' Loop from I7 until empty cell is found, and calculate expected output
Set currentCell = Range("I7")
Do While Not IsEmpty(currentCell.Value)
@drahosistvan
drahosistvan / clear-teams-cache.sh
Created September 23, 2021 12:29
Close Microsoft Teams and clear all caches
#!/bin/bash
killall Teams
rm -rf ~/Library/Caches/com.microsoft.teams
rm -rf ~/Library/Application\ Support/Microsoft/Teams/Application\ Cache/Cache
rm -rf ~/Library/Application\ Support/Microsoft/Teams/blob_storage
rm -rf ~/Library/Application\ Support/Microsoft/Teams/Cache
rm -rf ~/Library/Application\ Support/Microsoft/Teams/databases
rm -rf ~/Library/Application\ Support/Microsoft/Teams/GPUCache
rm -rf ~/Library/Application\ Support/Microsoft/Teams/IndexedDB
@drahosistvan
drahosistvan / restart-required.sh
Created June 27, 2017 14:50
Check if restart required on Ubuntu
#!/bin/bash
if [ ! -f /var/run/reboot-required ]; then
# no reboot required (0=OK)
echo "OK: no reboot required"
exit 0
else
# reboot required (1=WARN)
echo "WARNING: `cat /var/run/reboot-required`"
exit 1
fi
@drahosistvan
drahosistvan / vatvalidation.php
Created March 9, 2017 20:53
EU VAT Number validation
<?php
$pattern = "/^(AT|B[GE]|C[YZ]|D[EK]|E[ELS]|F[IR]|GB|H[RU]|I[ET]|L[TUV]|MT|NL|P[LT]|RO|S[EIK])([A-Z]|[0-9])+$/";
$vatnumber = strtoupper($_REQUEST['q']);
$value = $vatnumber;
if (preg_match($pattern, $vatnumber)){
// Create validation request to VIES service
$country_code = substr($vatnumber, 0, 2);
$vatnum = substr($vatnumber, 2, strlen($vatnumber)-2);
$client = new SoapClient("http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl");
@drahosistvan
drahosistvan / viberdownloads.sh
Created December 11, 2016 13:25
Modify the download folder in Viber for OSX
#!/bin/bash
if [ -z "$1" ]
then
echo "Please specify a folder"
exit
fi
if [ -z "$2" ]
then
@drahosistvan
drahosistvan / composer.json
Created March 31, 2016 11:14
How to define custom repos in composer.json
"repositories": [
{
"type": "vcs",
"url": "pwd/path/for/git/repo"
}
],
@drahosistvan
drahosistvan / countries.php
Last active March 11, 2016 14:53 — forked from JeffreyWay/countries.php
Countries array by "code" => "name"
<?php
/*
* Special thanks to Jeffrey Way
* Original file: https://gist.github.com/JeffreyWay/224de894c4d4e228d5af
*/
return [
"us" => "United States",
"af" => "Afghanistan",
@drahosistvan
drahosistvan / super.icls
Last active January 24, 2016 17:11
PhpStorm color theme based on daylerees's Super theme
<scheme name="Super" version="142" parent_scheme="Default">
<option name="LINE_SPACING" value="1.4" />
<option name="EDITOR_FONT_SIZE" value="14" />
<option name="CONSOLE_FONT_NAME" value="Menlo" />
<option name="CONSOLE_FONT_SIZE" value="10" />
<option name="EDITOR_FONT_NAME" value="Menlo" />
<colors>
<option name="ADDED_LINES_COLOR" value="292d38" />
<option name="ANNOTATIONS_COLOR" value="8b999f" />
<option name="CARET_COLOR" value="7b7d83" />