Skip to content

Instantly share code, notes, and snippets.

View pgorod's full-sized avatar

pgorod

View GitHub Profile
@pgorod
pgorod / permsplainer.sh
Last active June 29, 2026 17:50
Permsplainer explains ownerships and permissions for specific files
#!/bin/bash
#use this to log debug, enclose blocks you want to examine in 'set -x' and 'set +x'
exec 19>lixo.txt # any unused file descriptor number will do
BASH_XTRACEFD=19
# USAGE ./permsplainer.sh FILE USER
# Default values:
[ -z $1 ] && FILE=/var/www/html/suitecrm.log || FILE=`realpath "$1"`
@pgorod
pgorod / Add_WindowsDefender_Exclusions.ps1
Created November 18, 2023 10:52 — forked from dkorobtsov/Add_WindowsDefender_Exclusions.ps1
PowerShell script to add Windows Defender exclusions for WSL2 and JetBrains IDE performance issues
# PowerShell script to add Windows Defender exclusions for WSL2 and JetBrains IDE performance issues
#
# For context please read this thread:
# https://github.com/microsoft/WSL/issues/8995
#
# How to use?
# - Save the Script: Open a text editor like Notepad and paste the PowerShell script into it.
# - Save the file with a .ps1 extension, for example, Add_WindowsDefender_Exclusions.ps1.
# - Run PowerShell as Administrator: Search for "PowerShell" in the Start menu, right-click on it, and choose "Run as administrator".
# - Navigate to the Script's Location: Use the cd command to navigate to the directory where you saved the .ps1 file.
@pgorod
pgorod / gist:afcc4adc321a8dd0e43c5a9f5dac0c17
Created July 3, 2023 15:36
RME Screenshots for forum question
See images in comments below.
@pgorod
pgorod / kunena3.rb
Created January 31, 2023 11:39
importing-from-kunena-3-to-discourse-2
require "mysql2"
require File.expand_path(File.dirname(__FILE__) + "/base.rb")
# If you change this script's functionality, please consider making a note here:
# https://meta.discourse.org/t/importing-from-kunena-3/
# Before running this script, paste these lines into your shell,
# then use arrow keys to edit the values
=begin
@pgorod
pgorod / base.rb
Created January 31, 2023 11:35
importing-from-kunena-3-to-discourse
# frozen_string_literal: true
if ARGV.include?('bbcode-to-md')
# Replace (most) bbcode with markdown before creating posts.
# This will dramatically clean up the final posts in Discourse.
#
# In a temp dir:
#
# git clone https://github.com/nlalonde/ruby-bbcode-to-md.git
# cd ruby-bbcode-to-md
@pgorod
pgorod / gist:bd53339fbf6bddbed824c762539ed058
Last active March 12, 2020 14:20 — forked from jmertic/gist:5660495
Programmatically Find the Name of the Relationship between two Modules
<?php
function getRelationshipByModules ($m1, $m2)
{
global $db,$dictionary,$beanList;
$rel = new Relationship;
if($rel_info = $rel->retrieve_by_sides($m1, $m2, $db)){
$bean = BeanFactory::getBean($m1);
$rel_name = $rel_info['relationship_name'];
foreach($bean->field_defs as $field=>$def){
@pgorod
pgorod / showAsPrint.js
Created June 25, 2019 09:51 — forked from jscher2000/showAsPrint.js
Emulate print media in Firefox 62 (userscript work in progress)
// For Firefox's Web Console, creates the functions showAsPrint() and undoShowAsPrint()
// to roughly emulate print media and revert
function showAsPrint(){
var docSS = document.styleSheets, ss, oldMedia, newMedia, rules;
var p2s = function(media){
if (media.indexOf('all') > -1) return media; //no need to change
if (media == 'print') return 'all, wasprint'; //show on screen, too
if (media.indexOf('print') > -1 && media.indexOf('screen') > -1) return media; //no need to change
if (media == 'screen') return 'wasscreen'; //hide these rules
if (media.indexOf('screen') > -1) return media.replace('screen', 'wasscreen'); //hide these rules
<?php
namespace Pokus;
class Exception extends \Exception
{
}
function tttt($string)
{
try {
@pgorod
pgorod / repair.php
Created December 12, 2018 18:04 — forked from chicks/repair.php
Quick Repair and Rebuild Sugar from the Command line - adapted from Jeff Bickhart's version.
#! /usr/bin/env php
<?php
# Stuff we have to do
if(!defined('sugarEntry'))define('sugarEntry', true);
function usage() {
global $argv;
return "\n" . $argv[0] . " <path to sugar>\n";
}
@pgorod
pgorod / Import_script.php
Last active December 24, 2024 11:36
Sample Import_script for SuiteCRM, CSV to beans and relationships, and security groups
<?php
//xdebug_break();
if (!defined('sugarEntry') || !sugarEntry) die ('Not a Valid Entry Point!');
$date= new DateTime();
//chdir('/opt/bitnami/apps/suitecrm/htdocs/');
echo 'School Importer started at ';
echo $date->format('r').'<br>';
echo '-------------------------------------------------------------------------------------------------------------------------------------<br>';