Skip to content

Instantly share code, notes, and snippets.

leommoore /
Last active May 13, 2023 15:24
Systemd Services 101

Check that your system supports systemd

pidof systemd

If this return a number then your system supports systemd. Most Linux distributions in 2017 support systemd.

Check out the proceses currently running.

Since systemd starts the process then all processes will be children of systemd

leommoore / btoa-atob.js
Last active November 19, 2017 08:00
btoa & atob
View btoa-atob.js
function btoa(str) {
if ((typeof str) !== 'string') {
str = JSON.stringify(str);
var buffer;
if (str instanceof Buffer) {
buffer = str;
leommoore /
Last active November 9, 2020 18:08
S3 Make a Bucket Public

S3 Make a Bucket Public

By default, files uploaded to Amazon S3 are private, requiring a separate action to make public. To make uploads default to public, add this policy to your S3 bucket.

  "Version": "2008-10-17",
  "Statement": [{
    "Sid": "AllowPublicRead",
 "Effect": "Allow",
leommoore /
Last active January 9, 2019 15:38 — forked from julionc/
How to install PhantomJS on Debian/Ubuntu

How to install PhantomJS on Ubuntu

Version: 2.1.1

Platform: x86_64

First, install or update to the latest system software.

sudo apt-get update
sudo apt-get install build-essential chrpath libssl-dev libxft-dev
leommoore /
Last active October 20, 2017 22:36 — forked from sheikhwaqas/
Install MongoDB Server on Ubuntu
# Download and Install the Latest Updates for the OS
apt-get update && apt-get upgrade -y
# Set the Server Timezone to CST
echo "America/Chicago" > /etc/timezone
dpkg-reconfigure -f noninteractive tzdata
# Enable Ubuntu Firewall and allow SSH & MySQL Ports
ufw enable
ufw allow 22


If your folder contains subfolders and more importantly symlinks you want to use rsync:

rsync -aruv localfolder/ user@server:destination/

Or in reverse:

rsync -aruv user@server:destination/ localfolder/
leommoore / string-utils.js
Created April 25, 2016 16:13 — forked from jonlabelle/string-utils.js
Useful collection of JavaScript string utilities.
View string-utils.js
// String utils
// resources:
// -- mout,
* "Safer" String.toLowerCase()
function lowerCase(str){
return str.toLowerCase();
leommoore /
Last active November 9, 2020 18:11
MongoDB 3.2.x Reporting

MongoDB 3.2.x Reporting

The find() operator creates a cursor to the data. The client can then parse through the data and do calculations on the data for reports purposes. However, with large data sets this is not practical. It makes far more sense for the server to do the calculations and return the result. This can save a considerable amount of unnecessary network traffic. You can however run the count on the cursor without much overhead.


Mongo has two other methods for reporting on data:

  • Aggregation
  • Map-Reduce
leommoore /
Last active August 16, 2022 17:35
MongoDB 3.2.x SSL with Letsencrypt

MongoDB 3.2.x SSL with Letsencrypt

Letsencrypt is an initative which aims to increase the use of encryption for websites. It basically allows people to apply for free certificates provided that they prove the they control the requested domain. We will look at the what is needed to secure your MongoDB installation. For more details on setting up a MongoDB server see MongoDB 3.2.x.

Set the hostname

We sould to set the hostname to match the name of the certificate we are going to optain.

sudo hostname

Then update the hostname file to set the server name permanently.

leommoore /
Last active October 19, 2018 00:39
MongoDB 3.2.x Security

#MongoDB 3.2.x Security

##Network Ports The standard ports used by mongo are:

ProcessRoleDefault Port