Skip to content

Instantly share code, notes, and snippets.

View pida42's full-sized avatar
🐋

pida42 pida42

🐋
  • Magrathean Republic
  • Earth... Sometimes Magrathea...
View GitHub Profile
@pida42
pida42 / Benchmark.php
Last active May 31, 2016 04:38
Simple benchmark class that allows you write markers in code and get info about exec time, memory usage and more...
<?php
/*
* The MIT License
*
* Copyright (c) 2016 Frantisek Preissler <github@ntisek.cz>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@pida42
pida42 / gitlab-update.sh
Last active June 27, 2017 10:20
Basic GitLab update script (from sources)
#!/bin/bash
##
# Usage:
# $ cd /home/git/gitlab
# $ CURRENT_VERSION=8-9-stable TARGET_VERSION=8-10-stable SHELL_VERSION=v3.2.3 WORKHOUSE_VERSION=v0.7.8 sh update.sh
##
cd /home/git/gitlab/
@pida42
pida42 / template_zabbix_agent_net_tcp_service.xml
Created August 30, 2018 16:21
Zabbix Agent with net.tcp.service
<?xml version="1.0" encoding="UTF-8"?>
<zabbix_export>
<version>3.4</version>
<date>2018-08-30T16:19:20Z</date>
<groups>
<group>
<name>Templates/Modules</name>
</group>
</groups>
<templates>
alfresco:
links:
- database
- solr
- activemq
- pdf-renderer
- imagemagick
- libreoffice
- tika
ports:
import os
import subprocess
import time
## If the parent process is ignoring that output,
## the Popen call cannot destroy the process as it has data sitting in a pipe and generates zombie processes.
#p = subprocess.Popen('ls -l /tmp', shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
#time.sleep(10)
(base) root@magrathea:~# conda install -c conda-forge opencv
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: -
Found conflicts! Looking for incompatible packages.
This can take several minutes. Press CTRL-C to abort.
failed |
@pida42
pida42 / create-certs.sh
Created March 8, 2021 04:27
Script which helps you to create CA, server and client certificates.
#!/usr/bin/env bash
function usage {
echo -n "
NAME
create-certs.sh - create CA, server and client certificates
SYNOPSIS
create-certs.sh [OPTION]...
@pida42
pida42 / ImapSync
Created September 12, 2020 07:19
#! /bin/sh
# imapcopy -- Sync IMAP accounts (from server account A to server account B)
# Copyright (C) 2016 Frantisek Preissler, <github@ntisek.cz>
# Released under the terms of The MIT License
#if [ $# != 4 ]
if [ $# != 1 ]
then
# echo Usage: imapcopy [SOURCE-USER] [SOURCE-PASS] [TARGET-USER] [TARGET-PASS]
@pida42
pida42 / .bash_aliases
Created September 2, 2021 13:18
Most common Bash Aliases
# Docker, Docker Compose
alias docker-clear='docker rm -f $(docker ps -q -a); docker rmi -f $(docker images -q); docker system prune --all --force --volumes'
alias docker-down='docker-compose down'
alias docker-images='docker images --all'
alias docker-logs='docker-compose logs --tail=1000 -f -t'
alias docker-ps='docker ps -a'
alias docker-up='DATE_FROM=`date`; echo "BUILD START: $DATE_FROM" ; docker-compose up -d --build; DATE_TO=`date`; echo -e "BUILD START: $DATE_FROM\nBUILD END: $DATE_TO\n"'
alias docker-up-nohup='DATE_FROM=`date`; echo "BUILD START: $DATE_FROM" ; nohup docker-compose up -d --build $ && DATE_TO=`date`; echo -e "BUILD START: $DATE_FROM\nBUILD END: $DATE_TO\n"'
# Kubernetes
@pida42
pida42 / .bashrc
Created September 2, 2021 13:25
Bash (.bashrc, .profile, ...) custom functions
# [...]
# Docker functions
function docker-exec() {
Container=$1
echo "Running command: docker exec -ti $Container /bin/bash"
docker exec -ti $Container /bin/bash
}
function docker-exec-sh() {