Skip to content

Instantly share code, notes, and snippets.

@rano9999
rano9999 / moodle_users.sql
Created September 8, 2022 01:23 — forked from arozellia/moodle_users.sql
Create and remove Moodle Users via MySQL Commands
/**
Create user.
Although this is the insert query, it is almost always better to use a web service rather than doing this manually. This way enforces Moodle standards and ensures quality data. Use at your own risk.
Webservice example: https://stackoverflow.com/questions/35881584/using-moodle-create-users-and-enroll-them-in-courses-via-sql
Code typically used: https://github.com/moodle/moodle/blob/a409707794cc6d74063787d27adb42154426c803/user/lib.php#L42
Note: The password is set using MD5, however Moodle dutifully transforms this to a much more secure password on initial login.
See: https://github.com/moodle/moodle/blob/06e3b6d8bab42b8e56d169d006f31f4a15684830/auth/manual/auth.php#L100
See: https://github.com/moodle/moodle/blob/a4f914b54dbafcaf1cc2bf1cce8bde30cc69db57/lib/moodlelib.php#L4575
@rano9999
rano9999 / replace_synology_ssl_certs.sh
Created September 5, 2022 04:43 — forked from catchdave/replace_synology_ssl_certs.sh
CLI script to programmatically replace SSL certs on Synology NAS
#!/bin/sh
#
# *** For DSM v6.x ***
#
# How to use this script:
# 1. Get your 3 PEM files ready to copy over from your local machine/update server (privkey.pem, fullchain.pem, cert.pem)
# and put into a directory (this will be $CERT_DIRECTORY).
# 2. Ensure you have a user setup on synology that has ssh access (and ssh access is setup).
# This user will need to be able to sudo as root (i.e. add this line to sudoers, <USER> is the user you create):
# <USER> ALL=(ALL) NOPASSWD: /var/services/homes/<USER>/replace_certs.sh
@rano9999
rano9999 / synology_surveillance_usb_archiver.sh
Created August 11, 2022 07:25 — forked from kevinmilner/synology_surveillance_usb_archiver.sh
Synology Surveillance Station USB storage archive workaround cron job
#!/bin/bash
# Synology Surveillance Station doesn't let you store recordings on USB storage, which means that you must
# use the internal (often mirrored) disks. This is less than ideal. Unfortunately, just symbolically
# linking the surveillance store directory to one on USB storage causes surveillance station to fail after
# a day or so. This workaround still uses your main storage for recording, but moves older files to USB storage
# for archival. The moved files themselves are symbolically linked back to the original storage location.
#
# Script should be run regularly, either by editing /etc/crontab or through Synology's built in script scheduling.
# Be sure to edit the user inputs below, and set up SS to keep recordings for longer than the external archive period.
uses
Printers;
//------------------------------------------------------------------------------
// Printer Device Debugging Code to TMemo Componenet
// (c) - 1999 / by A. Weidauer
// [email protected]
//------------------------------------------------------------------------------
procedure GetDeviceSettings(DevCtrl: TMemo);
@rano9999
rano9999 / Git tooltips.rdoc
Created October 19, 2021 07:14 — forked from jzzdog/Git tooltips.rdoc
Git tooltips

Git installation

Ubuntu

$ sudo apt-get install git

Windows

install git from downloaded setup file. Add this block to config to ignore ssl verification erros or increase buffer

[http]
@rano9999
rano9999 / Ubuntu tooltips.rdoc
Created October 19, 2021 07:06 — forked from jzzdog/Ubuntu tooltips.rdoc
Ubunutu tooltips

Initial server settings

Create new user

adduser deploy

Add new usert to the sudo group

gpasswd -a deploy sudo

Check your local ssh config and add new host

cat ~/.ssh/config
@rano9999
rano9999 / MySql Tooltips.md
Created October 19, 2021 07:05 — forked from jzzdog/MySql Tooltips.md
MySql Tooltips

MySql Initial settings

$ mysql -u root -p
mysql> CREATE DATABASE azcommunity_production DEFAULT CHARACTER SET utf8;
mysql> GRANT ALL PRIVILEGES ON azcommunity_production.* TO 'deploy'@'localhost' 
       IDENTIFIED BY 'deploy';
mysql> EXIT;
@rano9999
rano9999 / gist:fbe7d83f63b3a8c48a10c7cf01b457a7
Created October 19, 2021 07:03
Delphi XE Webcam output
My Youtube channel https://www.youtube.com/channel/UCqoBcT48z7B1ajAC_3746Nw
I am in telegrams @MrRobot4d725f526f626f74
Download project https://yadi.sk/d/crJigBryL5qUfw
Password archive: 12345
///////////////////////////////////////////////
unit source_cam;
interface
@rano9999
rano9999 / gist:ebc06a14b325312b7274b3b103e345a5
Created October 19, 2021 07:02
Delphi XE Hiding the file in the msconfig startup tab and hiding the file in the startup registry branch regedit
unit Unit1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Commctrl;
type
TForm1 = class(TForm)
@rano9999
rano9999 / gist:9b33b99b74d333a9c9e03de1013e2dc4
Created October 19, 2021 07:02
Delphi XE Hide third-party application icon in tray
unit Unit1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Commctrl, Vcl.StdCtrls, sButton, ShellAPI,
Vcl.ComCtrls, ExtCtrls, Menus;
type