Skip to content

Instantly share code, notes, and snippets.

Leo Moore leommoore

  • Ireland
Block or report user

Report or block leommoore

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@leommoore
leommoore / systemd_services.md
Last active Mar 22, 2019
Systemd Services 101
View systemd_services.md

Check that your system supports systemd

pidof systemd
2733

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

View btoa-atob.js
function btoa(str) {
if ((typeof str) !== 'string') {
str = JSON.stringify(str);
}
var buffer;
if (str instanceof Buffer) {
buffer = str;
@leommoore
leommoore / s3_make_a_bucket_public.md
Last active Feb 16, 2019
S3 Make a Bucket Public
View s3_make_a_bucket_public.md

#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
leommoore / 00.howto_install_phantomjs.md
Last active Jan 9, 2019 — forked from julionc/00.howto_install_phantomjs.md
How to install PhantomJS on Debian/Ubuntu
View 00.howto_install_phantomjs.md

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
leommoore / setup-mongodb.sh
Last active Oct 20, 2017 — forked from sheikhwaqas/setup-mongodb.sh
Install MongoDB Server on Ubuntu
View setup-mongodb.sh
# 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
View rsync.md

##rsync

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
leommoore / string-utils.js
Created Apr 25, 2016 — forked from jonlabelle/string-utils.js
Useful collection of JavaScript string utilities.
View string-utils.js
// String utils
//
// resources:
// -- mout, https://github.com/mout/mout/tree/master/src/string
/**
* "Safer" String.toLowerCase()
*/
function lowerCase(str){
return str.toLowerCase();
@leommoore
leommoore / mongodb_3.2.x_reporting.md
Last active Nov 21, 2017
MongoDB 3.2.x Reporting
View mongodb_3.2.x_reporting.md

#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.

db.mycollection.find().count()

Mongo has two other methods for reporting on data:

  • Aggregation
  • Map-Reduce
@leommoore
leommoore / mongodb_ssl_with_letsencrypt.md
Last active Aug 7, 2019
MongoDB 3.2.x SSL with Letsencrypt
View mongodb_ssl_with_letsencrypt.md

#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 mongo0.example.com

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

@leommoore
leommoore / mongodb_3.2.x_security.md
Last active Oct 19, 2018
MongoDB 3.2.x Security
View mongodb_3.2.x_security.md

#MongoDB 3.2.x Security

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

ProcessRoleDefault Port
You can’t perform that action at this time.