Skip to content

Instantly share code, notes, and snippets.

View benahm's full-sized avatar
🎯
Focusing

Ahmed BENSAAD benahm

🎯
Focusing
  • Paris
View GitHub Profile
@benahm
benahm / log.sh
Created February 8, 2014 00:51
log.sh
#!/bin/bash
LOG_FILE_NAME='MyLogFile'
LOG_FILE_PATH='../log/'
LOG_LEVEL='3' # DEBUG=4 INFO=3 WARN=2 ERR=1 NONE=0
LOG_OUTPUT='2' # STDOUT=1 FILE=2 BOTH=3
_log_level_string=( DEBUG INFO WARN ERR NONE )
_log_output_string=( STDOUT FILE BOTH )

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+C copy current line (if no selection)
Ctrl+X cut current line (if no selection)
Ctrl+⇧+K delete line
Ctrl+↩ insert line after
@benahm
benahm / plsqlLogger.sql
Last active August 29, 2015 13:57
Log_pkg in PL/SQL (Need SEQ_LOG_ID sequence, LOGS table and function to get Log Level)
CREATE OR REPLACE PACKAGE body log_pkg
IS
PROCEDURE insert_log(
log_type VARCHAR2,
log_code VARCHAR2,
log_message VARCHAR2)
IS
pragma autonomous_transaction;
LOG_ID INTEGER;
BEGIN
@benahm
benahm / csv2html.sh
Last active April 14, 2020 11:40
CSV => HTML table
#!/bin/bash
# csv to html
usage()
{
cat <<EOF
Usage: $(basename $0) [OPTIONS] input > output
Script to produce HTML tables from delimited input. Delimiter can be specified
as an optional argument. If omitted, script defaults to comma.
@benahm
benahm / scriptLocked.sh
Created June 4, 2014 13:58
Locking a bash script against a parallel run
lockfile=/var/tmp/mylock
if ( set -o noclobber; echo "$$" > "$lockfile") 2> /dev/null; then
trap 'rm -f "$lockfile"; exit $?' INT TERM EXIT
# do stuff here
# clean up after yourself, and release your trap
rm -f "$lockfile"
Contact con = (Contact)TestDataFactory.createSObject('Contact');
@benahm
benahm / GenerateFullPackageXML.sh
Last active July 16, 2023 06:42
Generate a full Package.xml using the Salesforce CLI
#!/bin/sh
#
# Generate a full package xml using the Salesforce CLI
# Requirements :
# * Salesforce CLI
# * jq
const puppeteer = require("puppeteer");
/*
* Puppeteer script to activate a user interface option
*/
// org credentials
const credentials = {
username: "test-szxxauz1kct8@example.com",
password: "XXXXXXX"
@benahm
benahm / project-scratch-def.json
Created October 23, 2019 12:31
Scratch org definition demo
{
"orgName": "Scratch org demo",
"description": "Scratch org definition demo",
"language": "en_US",
"edition": "Developer",
"features": [
"Sites",
"Communities",
"PersonAccounts",
"MultiCurrency",
@benahm
benahm / deployDestructiveChange.sh
Last active February 15, 2024 18:45
Deploy a destructive change using the Salesforce CLI
#!/bin/sh
#
# author : benahm
# description : deploy a destructive change
# inputs
TARGET_ENV=$1
SOURCE_PATH=$2
# constants