Skip to content

Instantly share code, notes, and snippets.

View sholloway's full-sized avatar
🐧
Coding, coding, coding

Samuel Holloway sholloway

🐧
Coding, coding, coding
View GitHub Profile
@sholloway
sholloway / Quicktime to Gif Shell Script
Created February 15, 2023 13:43
This script converts a Quicktime MOV file into an animated GIF.
###############################################################################
# This script converts a Quicktime MOV file into an animated GIF.
# Based on: https://abitawake.com/news/articles/how-we-make-gifs-for-twitter
#
# Dependencies
# - ffmpeg
# - gifsicle
#
# Usage
# ./mov_to_gif.sh a_movie.mov new_gif.gif
import java.util.Scanner;
public class ArrayExamples {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
final int N = 2;
final int M = 2;
final int P = 3;
additionExample(N, M, input);
@sholloway
sholloway / SalesforcePrefixUtil.apex
Last active April 28, 2023 14:50
Work with Salesforce Prefixes.
//Find an entity's prefix
String prefix = MyObjectType.SObjectType.getDescribe().getKeyPrefix();
System.debug(prefix);
class PrefixFinder{
public String findObjectName(String recordIdOrPrefix){
String objectName = '';
try{
String providedPrefix = String.valueOf(recordIdOrPrefix).substring(0,3);
Map<String, Schema.SObjectType> allObjectsTypes = Schema.getGlobalDescribe();
@sholloway
sholloway / node.html
Last active March 8, 2019 14:52
Node-RED Custom Node Template
<script type="text/javascript">
RED.nodes.registerType('NODE_NAME',{
category: 'The Category',
color: '#C0DEED',
defaults: {
},
inputs: 1,
outputs: 1,
icon: "file.png",
label: function() {
@sholloway
sholloway / SOQL Queries.sql
Last active January 22, 2024 14:43
Useful SOQL queries for exploring a Salesforce org.
--------------------------------------------------------------------
-- Queries related to distribution of metadata.
-- Find the number of users per profile.
SELECT count(id), Profile.name
FROM User
WHERE User.IsActive = true
GROUP BY Profile.name
-- Find the distribution of Apex classes per namespace.
select count(id), NameSpacePrefix

Sublime Text 2 – Useful Shortcuts (Mac OS X)

SublimeTodo

Keywords

⌘⌃P Type ‘show’ to see the list.
NOTE Creates a note.
TODO Creates a ToDo.
FIXME Flags something as a bug.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sholloway
sholloway / nginx_virtual_host_example
Created February 17, 2013 14:37
An example of how to set up an nginx virtual host.
server {
listen 80;
server_name www.domain1.com;
rewrite ^/(.*) http://domain1.com/$1 permanent;
}
server {
listen 80;
server_name domain1.com;
@sholloway
sholloway / nginx_setup
Last active December 13, 2015 20:19
setting up multiple sites on nginx locally
# install
brew install nginx
#Add nginx to the path
#set up sites-available, sites-enabled
cd /usr/local/etc/nginx/
mkdir sites-available sites-enabled
#make sure that the primary nginx config file has included the sites-enabled dir
@sholloway
sholloway / PostGIS install
Created January 13, 2013 23:23
Set up a spatial database with PostGIS on EC2 using an EBS.
Steps:
Set up EBS
21Created 1 TB EBS
Created 64 Bit Amazon Linux AMI 2012.09 M1 Medium 3.7 gb ram, 2 ECUs
Connect to ec2 instance via ssh
chmod 400 IFS-KeyPair.pem
ssh -v -i IFS-KeyPair.pem ec2-user@ec2-54-234-14-65.compute-1.amazonaws.com
Note: Do not replace ec2-user with your user id. This is a AWS Amazon AMI requirement.