Skip to content

Instantly share code, notes, and snippets.

View eddywebs's full-sized avatar

Adi eddywebs

View GitHub Profile
@eddywebs
eddywebs / gist:52080a1535f8014bae035dbd42cf9008
Created November 16, 2022 20:07 — forked from dancinllama/gist:8f789e759dda1ce0a883
Thou shalt not put queries in loops (good example)
List<Account> accList = new List<Account>(
[Select
Id
,Name
,(Select
Email
From
Contacts
)
From Account]
@eddywebs
eddywebs / self-signed-certificate-with-custom-ca.md
Created March 9, 2018 20:25 — forked from fntlnz/self-signed-certificate-with-custom-ca.md
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
#the follow file ends with .conf and needs to be in the /etc/rsyslog.d dir
*.* @<GRAYLOG SERVER>:<PORT>;RSYSLOG_SyslogProtocol23Format
FOR E.G. *.* @192.168.0.1:5514;RSYSLOG_SyslogProtocol23Format
Pricebook2 pb = new Pricebook2(Name = 'Standard Price Book 2009', Description = 'Price Book 2009 Products', IsActive = true );
insert pb;
Product2 prod = new Product2(Name = 'SLA: Bronze', IsActive = true);
insert prod;
// First insert a price for the standard price book
Pricebook2 standardPB = [select id from Pricebook2 where isStandard=true];
PricebookEntry standardPBE = new PricebookEntry(Pricebook2Id = standardPB.Id, Product2Id = prod.Id, UnitPrice = 1000, IsActive = true);
insert standardPBE;
PricebookEntry pbe = new PricebookEntry(Pricebook2Id = pb.Id, Product2Id = prod.Id, UnitPrice = 1000, IsActive = true);
insert pbe;
List<Id> accountids = new List<Id>();
accountids.addAll(new Map<Id, sObject>([select id from account where parentid='0016000000zK5N7AAK']).keyset());
system.debug(accountids);
//redirect a page to visualforce page
ApexPages.PageReference pg = new ApexPages.PageReference('/apex/<VisualForcePage>?id='+Contact.Id);
pg.setRedirect(true);
return pg;
I first needed to install rpi-update...
"sudo apt-get install rpi-update"
the update the kernel using:
sudo rpi-update
@eddywebs
eddywebs / 01-expand.sh
Created April 24, 2016 02:03
auto expand rootfs on boot
sudo killall fbi >/dev/null 2>&1
dialog --infobox "\nWelcome to retro gaming console - First time boot ! hang tight - Resizing the filesystem ..." 5 60
sudo raspi-config nonint do_expand_rootfs >/dev/null 2>&1
sleep 2
dialog --infobox "\nDone. Rebooting now- ready to play in few moments..." 5 60
sudo rm -f /etc/profile.d/01-expand.sh
sleep 2
sudo reboot
#add remote repo from where commit needs to be pulled
git remote add <remote-repo> <git repository>
#fetch all the updates from remote-repo
git fetch <remote-repo>
#when the changes from the repo are fetched issue command below
git cherry-pick --strategy=recursive -X theirs <here-goes-sha1-for-commit-to-pull-from-remote-repo>
@eddywebs
eddywebs / AddressFuture
Created October 26, 2015 17:18 — forked from quintonwall/AddressFuture
Example of using JSON serialization to pass complex objects to @future handlers in Apex
/**
* Example of using JSON serialization to pass complex objects to @future handlers in Apex
* $author: qwall@salesforce.com
*/
public with sharing class AddressFuture {
public AddressFuture () {
List<String> addresses = new List<String>();
AddressHelper ah1 = new AddressHelper('1 here st', 'San Francisco', 'CA', '94105');