Skip to content

Instantly share code, notes, and snippets.

@av-jok
av-jok / pynetbox_examples.md
Last active November 16, 2023 22:19 — forked from awfki/pynetbox_examples.md
pynetbox examples

pynetbox examples

Long time network engineer, did some perl a long time ago and am liking python pretty well but the pynetbox documentation is badly lacking IMO. If I were a python wizard I'm sure it would all be obvious but I'm not and it's really frustrating that more example weren't provided.

Many of the following examples were cadged from various places on the interwebs and HAVE NOT BEEN TESTED.

Prereqs

import pynetbox
NETBOX = 'https://netbox.fq.dn/'
nb = pynetbox.api(NETBOX, get_token('nb'))
@av-jok
av-jok / mysql_statistcs.sh
Created April 2, 2022 11:00 — forked from rafaelfoster/mysql_statistcs.sh
Zabbix Mysql Statistcs
#!/bin/bash
#
# This script get all Mysql database size (except the internal one) and display it as a Json
# that can be used to Zabbix Discovery Rules.
#
# This simple script was created by RafaelFoster: rafaelgfoster (at) gmail (dot) com
#
# Json Output: {"data": [ { "{#DBNAME}" : "database_name","{#DBSIZE}":"size_in_bytes"},{"{#DBNAME}":"database_name2","{#DBSIZE}":"size_in_bytes"} ] }
cd $HOME
@av-jok
av-jok / versionCleanX.php
Created October 30, 2021 21:45 — forked from geforester/versionCleanX.php
Remove old versions from VersionX
<?php
/**
* versionCleanX
*
* @author Scott Pronych, September 27, 2013
*
* DESCRIPTION
*
* For use with VersionX to delete old content
*
@av-jok
av-jok / backup.sh
Created October 27, 2021 08:22 — forked from andronex/backup.sh
Скрипт для бэкапа
#!/bin/bash
#настройки для подключения к БД
USER="login" #логин для подключения к БД
PASS="pass" #пароль для подключения к БД
DB_NAME="db_name" #имя БД
#запускать для сохранения бэкапа
#переходим в директорию выше корня сайта
cd ~
@av-jok
av-jok / Crack Sublime Text Windows and Linux.md
Created October 3, 2021 18:21 — forked from JerryLokjianming/Crack Sublime Text Windows and Linux.md
Crack Sublime Text 3.2.2 Build 3211 and Sublime Text 4 Alpha 4098 with Hex

YouTube Channel https://www.youtube.com/c/jerrylokjianming


How to Crack Sublime Text 3.2.2 Build 3211 with Hex Editor (Windows | Without License) ↓

  1. Download & Install Sublime Text 3.2.2 Build 3211
  2. Visit https://hexed.it/
@av-jok
av-jok / PrusaSlicer-End-Mirror-Duplication.gcode
Created June 6, 2021 12:41 — forked from mikejr83/PrusaSlicer-End-Mirror-Duplication.gcode
Various Custom G-Code for the Artist-D in Prusa Slicer
G91 ;Relative positioning
G0 E-2 F2700 ;Retract a bit
G0 E-2 Z0.2 F2400 ;Retract and raise Z
G0 X5 Y5 F3000 ;Wipe out
G0 Z10 ;Raise Z more
G90 ;Absolute positionning
G0 Y310 ;Present print
M106 S0 ;Turn-off fan
@av-jok
av-jok / letsencrypt_esxi.sh
Created May 11, 2021 18:43 — forked from shr00mie/letsencrypt_esxi.sh
Let's Encrypt SSL for ESXi
#!/bin/bash
#
## -----------------------------=[ WARNING ]=-------------------------------- ##
#
# This script is now woefully out of date due to which accounts ESXi allows to
# ssh into the box as well as sticky folders/file flags.
# I've since ported the whole thing to python with a lot of bells and whistles
# and if i get around to making it public, i'll put a link here.
#
## -------------------------------=[ Info ]=--------------------------------- ##
@av-jok
av-jok / csv-to-php.php
Created January 12, 2021 02:22 — forked from ig0r74/csv-to-php.php
CSV to PHP
<?php
$csvData = file_get_contents($fileName);
$lines = explode(PHP_EOL, $csvData);
$array = array();
foreach ($lines as $line) {
$array[] = str_getcsv($line);
}
print_r($array);
@av-jok
av-jok / form.tpl
Created January 12, 2021 02:21 — forked from ig0r74/form.tpl
MODX Formit Одно из двух полей обязательно для заполнения.
{'!AjaxForm' | snippet : [
'snippet' => 'FormIt',
'form' => 'orderFormTpl',
'emailTpl' => 'orderEmailTpl',
'hooks' => 'email',
'emailFrom' => $_modx->config.emailsender,
'emailFromName' => $_modx->config.site_name,
'emailSubject' => 'Заявка на подбор оборудования {$_modx->config.site_name}',
'emailTo' => $_modx->config.emailsender,
'validate' => 'name:required,phone:oneOfTwoFields,email:oneOfTwoFields,link:blank',
@av-jok
av-jok / change_prefix.php
Created January 12, 2021 02:19 — forked from ig0r74/change_prefix.php
Изменить префикс у таблиц MODX Revolution
<?php
ini_set("max_execution_time", 0);
ignore_user_abort(true);
$current_prefix = $modx->config['table_prefix'];
$new_prefix = 'My_Prefix234_';
$stmt = $modx->query("SHOW TABLES");
$tables = $stmt->fetchAll(PDO::FETCH_NUM);