Skip to content

Instantly share code, notes, and snippets.

View pgorod's full-sized avatar

pgorod

View GitHub Profile
@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>';
@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 / backup_github_issues.sh
Last active October 5, 2024 11:09 — forked from bojanpopic/backup_github_issues.sh
A (dirty) bash script that will backup issues from the GitHub repo using API. It takes pagination into consideration. Originally created by @boombatower, improved by @bojanpopic, them improved by me to handle number of pages automatically.
#!/bin/bash
# based on the script by Bojan Popic https://gist.github.com/bojanpopic/2c3025d2952844de1dd0
# Gets all issues form a repo. Since Pull Requests are also Issues in Github internally, these are also included.
repo="organization/repoName" # put the name of the repo here. Usually it is like this: organization/repo-na$
username="myuser" # your github username
password="mypassword" # your github password
# this script can be used on public repos with any user's credentials, you don't have to own the repo!
<?php
namespace Pokus;
class Exception extends \Exception
{
}
function tttt($string)
{
try {
@pgorod
pgorod / gist:5de7c6f8d37413654b16e06668d7e1b1
Last active February 12, 2024 19:36 — forked from jmertic/gist:3684156
HOWTO: Adding your own ListView action items - Part 1
<?php
require_once('include/MVC/View/views/view.list.php');
class CustomAccountsViewList extends ViewList
{
/**
* @see ViewList::preDisplay()
*/
public function preDisplay()
@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