Skip to content

Instantly share code, notes, and snippets.

View gnanet's full-sized avatar

Gergely Nagy gnanet

  • Self-Employed Freelancer
  • Hungary
  • X @gnanet
View GitHub Profile
@webdevs-pro
webdevs-pro / page-update.php
Created October 3, 2021 18:02
Elementor data widget controls updater
<?php
function update_controls( $elements ) {
$new_elements = array();
foreach ( $elements as $element_index => $element ) {
foreach ( $element as $key => $value ) {
if ( $key == 'elements' && ! empty( $value ) ) {
$new_elements[$element_index][$key] = update_controls( $value );
@scr34m
scr34m / dns_dotroll.sh
Last active June 9, 2023 07:29
Acme.sh DNS API interface for Dotroll
#!/usr/bin/bash
# Dotroll domain api
# - api access values stored per domain, including migration from account stored values
# - zone data is POST-ed to avoid "414 Request-URI Too Large" errors
#
# Initially export values Dotroll_User and Dotroll_Password
# export Dotroll_User='<your.dotroll@user>'; export Dotroll_Password='<dotroll_api_password>'; acme.sh --issue --dns dns_dotroll -d <domain.tld> -d '*.<domain.tld>'
# Usage: add _acme-challenge.www.domain.com "XKrxpRBosdIKFzxW_CT3KLZNf6q0HG9i01zxXp5CPBs"
@JuanDMeGon
JuanDMeGon / Kernel.php
Last active November 28, 2023 15:13
A small Laravel command to collect the sessions garbage if applicable to the current session driver
<?php
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
//...
@BenSampo
BenSampo / deploy.sh
Last active July 16, 2024 07:53
Laravel deploy script
# Change to the project directory
cd $FORGE_SITE_PATH
# Turn on maintenance mode
php artisan down || true
# Pull the latest changes from the git repository
# git reset --hard
# git clean -df
git pull origin $FORGE_SITE_BRANCH
@RichardBronosky
RichardBronosky / README.md
Last active July 10, 2024 14:10
Using cloud-init for cloudless provisioning of Raspberry Pi

Installing cloud-init on a fresh Raspbian Lite image

This is a work in Progress!

Purpose

This mainly demonstrates my goal of preparing a Raspberry Pi to be provisioned prior to its first boot. To do this I have chosen to use the same cloud-init that is the standard for provisioning servers at Amazon EC2, Microsoft Azure, OpenStack, etc.

I found this to be quite challenging because there is little information available for using cloud-init without a cloud. So, this project also servers as a demonstration for anyone on any version of Linux who may want to install from source, and/or use without a cloud. If you fall into that later group, you probably just want to read the code. It's bash so everything I do, you could also do at the command line. (Even the for loop.)

@hyunto
hyunto / backup_rsync.sh
Created January 30, 2018 07:28
backup data using rsync
#!/bin/bash
set -e
DATE="`date +%Y%m%d_%H%M%S`"
TYPE=""
SRC_DIR=""
DEST_DIR=""
BACKUP_DIR=""
@diegopacheco
diegopacheco / npm-nvm-nodejs-linux-debian-jessie.md
Created January 26, 2018 16:35
How to install NodeJs, NPM and NVM on Linux Debian 8 - Jessie
sudo apt-get update -y
sudo apt-get install build-essential libssl-dev -y
curl -sL https://deb.nodesource.com/setup_9.x| bash -
apt-get install -y nodejs
curl -sL https://raw.githubusercontent.com/creationix/nvm/v0.32.0/install.sh -o install_nvm.sh
bash install_nvm.sh
source ~/.profile
nvm install 9.4.0
nvm use 9.4.0
@xianx
xianx / backup
Last active March 3, 2018 00:04
RSync
sudo rsync -vrazh --progress root@69.64.65.11:/backup/ /ebs/containers/percona-tdba-d/backup
@stroebs
stroebs / backup-daily.sh
Created October 28, 2017 00:07
Simple tar + rsync backup method
#!/bin/bash
DATE=$(date +%Y%m%d)
FILE="backup-$DATE.tar.gz"
LOG="/tmp/backup-$DATE.log"
RSYNC_PASSWORD="supersecret"
RSYNC_CMD="-a --delete /$FILE rsync://backup-user@backup-server.tld:/backup-dir/daily/"
export RSYNC_PASSWORD=$RSYNC_PASSWORD
cd /
tar -cpzf $FILE \
--exclude=/*.tar.gz \
@tperalta82
tperalta82 / damnedd3.php
Last active May 3, 2018 23:43
Reboot D3 on fail board
#!/usr/bin/php
<?php
$hosts = array("antminer1","antminer2");
$minercreds = array( "user" => "root", "pass" => "becauseIAmHigh");
$failhashboard = "oxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxx";
/* I'm too stoned to try and detect how many hashboards are there*/
$possiblehashboards = 4;
foreach($hosts as $host)
{