Skip to content

Instantly share code, notes, and snippets.

View danie1k's full-sized avatar
😈
Automate! Automate everything!...

Daniel Kuruc danie1k

😈
Automate! Automate everything!...
View GitHub Profile
@danie1k
danie1k / user-style.css
Last active January 28, 2021 16:33
BitBucket New Style Pull Request view user-style
.sc-jtRlXQ {
padding-left: 2.5rem;
}
/* background */
.sc-fOICqy {
border-radius: 24px 16px 16px 16px;
border: 1px solid #fff;
margin-right: -1px;
margin-bottom: -1px;
@danie1k
danie1k / Cargo.toml
Last active February 4, 2020 21:56
Simplest Rust Qt5 "Hello World" example
[package]
name = "hello_world"
version = "0.1.0"
edition = "2018"
[dependencies]
qt_core = "*"
qt_gui = "*"
qt_widgets = "*"
@danie1k
danie1k / update_qnap_cert.sh
Created October 17, 2019 21:42
Update QNAP SSL Certificate via CLI
#!/usr/bin/env sh
set -e
# Based on https://www.hozed.net/?p=538
SSH_STRING=""
SSH_PORT="22"
# FYI: Assuming, that cert files are present and named: cert.key & cert.cert
scp -P $SSH_PORT cert.key $SSH_STRING:/etc/stunnel/backup.key &>/dev/null
@danie1k
danie1k / download_opnsense_cert.curl.sh
Last active December 19, 2024 10:40
Export SSL Certificate from OPNsense to file
#!/usr/bin/env sh
# Based on https://forum.netgate.com/post/785981
HOSTNAME=""
CERT_ID=""
USERNAME=""
PASSWORD=""
echo "Downloading certificate id=${CERT_ID} from ${HOSTNAME} into cert.pem file..."
#!/usr/bin/env bash
tarBranch=$(git branch -r --merged | grep -v master | grep -v develop | sed 's/origin\///')
for branch in $tarBranch
do
echo "Branch: $branch"
lastDate=$(git show -s --format=%ci origin/$branch)
convertDate=$(echo $lastDate | cut -d' ' -f 1)
Todate=$(date -d "$convertDate" +'%s')
current=$(date +'%s')
@danie1k
danie1k / recursive_dict_counter.py
Created September 29, 2017 09:15
Total recursive dict len counter
# https://stackoverflow.com/a/35428134
def _counter(d):
# how many keys do we have?
yield len(d)
# stream the key counts of our children
for v in iter(d.values()):
if isinstance(v, dict):
"""
csv exporter
~~~~~
Usage:
* in your admin class for model, insert: actions = [ download_as_csv_view ]
* add columns names in HEADER
* add data columns in _make_csv_row
:copyright: (c) https://github.com/danie1k
@danie1k
danie1k / removeOrders.sql
Last active December 14, 2015 07:28
Remove all orders from Magento
SET FOREIGN_KEY_CHECKS=0;
TRUNCATE `sales_flat_creditmemo`;
TRUNCATE `sales_flat_creditmemo_comment`;
TRUNCATE `sales_flat_creditmemo_grid`;
TRUNCATE `sales_flat_creditmemo_item`;
TRUNCATE `sales_flat_invoice`;
TRUNCATE `sales_flat_invoice_comment`;
TRUNCATE `sales_flat_invoice_grid`;
TRUNCATE `sales_flat_invoice_item`;
TRUNCATE `sales_flat_order`;
@danie1k
danie1k / removeProducts.sql
Last active January 27, 2016 11:51
Remove all Products from Magento
SET FOREIGN_KEY_CHECKS = 0;
TRUNCATE TABLE `catalog_product_bundle_option`;
TRUNCATE TABLE `catalog_product_bundle_option_value`;
TRUNCATE TABLE `catalog_product_bundle_selection`;
TRUNCATE TABLE `catalog_product_entity_datetime`;
TRUNCATE TABLE `catalog_product_entity_decimal`;
TRUNCATE TABLE `catalog_product_entity_gallery`;
TRUNCATE TABLE `catalog_product_entity_int`;
TRUNCATE TABLE `catalog_product_entity_media_gallery`;
TRUNCATE TABLE `catalog_product_entity_media_gallery_value`;