Skip to content

Instantly share code, notes, and snippets.

@vratiu
vratiu / organize_jpeg.py
Created February 6, 2022 15:31
Move digit ending jpeg files into subfolders
import os
import re
import shutil
regex = re.compile('^(.*)_\d+\.jpeg$')
dir_path = os.path.dirname(os.path.realpath(__file__))
files = [f for f in os.listdir('.') if (os.path.isfile(f) and regex.match(f))]
dirs = []
for f in files:
dirname = regex.match(f).group(1)
@vratiu
vratiu / cheats.js
Last active November 19, 2023 17:38
Sidecar CheatSeet
//create a bean from console
var callbean = App.data.createBean('Calls', {
"name": "issue 80737 call log",
"date_start": "2016-10-08T03:15:30+00:00",
"duration_minutes": 15,
"duration_hours": 0,
"assigned_user_id": "6ff50560-3589-23fa-eced-56ebf8835e3d"
});
// save the bean to server
callbean.save();
@vratiu
vratiu / qrr.php
Created March 26, 2015 13:46
Quick repair and rebuild script
<?php
if (php_sapi_name() !== "cli") {
die(1);
}
define('sugarEntry', true);
$runSQL = false;
if (!empty($_SERVER['argv'][1]) && $_SERVER['argv'][1] == 'true') {
@vratiu
vratiu / sugarapi.diff
Last active August 29, 2015 14:04
buildFileURL clear cache fix
diff --git a/lib/sugarapi/sugarapi.js b/lib/sugarapi/sugarapi.js
index e2c2b86..a052b95 100644
--- a/lib/sugarapi/sugarapi.js
+++ b/lib/sugarapi/sugarapi.js
@@ -270,6 +270,8 @@ SUGAR.Api = (function() {
_accessToken = null,
_refreshToken = null,
_downloadToken = null,
+ //Api Initialization time
+ _apiInitTime = null,
@vratiu
vratiu / .bash_aliases
Last active May 25, 2024 15:28
Git shell coloring
# Customize BASH PS1 prompt to show current GIT repository and branch.
# by Mike Stewart - http://MediaDoneRight.com
# SETUP CONSTANTS
# Bunch-o-predefined colors. Makes reading code easier than escape sequences.
# I don't remember where I found this. o_O
# Reset
Color_Off="\[\033[0m\]" # Text Reset
@vratiu
vratiu / gist:9780082
Created March 26, 2014 10:03
Git log improvement
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%C(bold blue)<%an>%Creset' --abbrev-commit"