Skip to content

Instantly share code, notes, and snippets.

@leommoore
leommoore / ionic_publish_android_app.md
Last active June 8, 2021 10:46
Ionic Publish Android App

#Ionic Publish Android App

This is the process to publish an ionic android app.

  1. Make sure you set/increment the version number in config.xml ie 0.0.3.

  2. Make sure the android platform has been added

@leommoore
leommoore / s3_make_bucket_public.md
Created June 3, 2015 10:48
S3 Make Bucket Public

#S3 Make Bucket Public

This comes from an excellent post from Gregory Schier.

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": [{
@leommoore
leommoore / s3.sh
Last active December 5, 2018 15:38 — forked from chrismdp/s3.sh
# You don't need Fog in Ruby or some other library to upload to S3 -- shell works perfectly fine
# This is how I upload my new Sol Trader builds (http://soltrader.net)
# Based on a modified script from here: http://tmont.com/blargh/2014/1/uploading-to-s3-in-bash
S3KEY="my aws key"
S3SECRET="my aws secret" # pass these in
function putS3
{
path=$1
@leommoore
leommoore / mongodb_backup_to_s3.sh
Created February 14, 2015 08:29
MongoDB Backup to S3 Script
#!/bin/bash
#
# Argument = -u user -p password -k key -s secret -b bucket
#
# To Do - Add logging of output.
# To Do - Abstract bucket region to options
set -e
export PATH="$PATH:/usr/local/bin"
@leommoore
leommoore / file_magic_numbers.md
Last active May 7, 2024 20:49
File Magic Numbers

File Magic Numbers

Magic numbers are the first bits of a file which uniquely identify the type of file. This makes programming easier because complicated file structures need not be searched in order to identify the file type.

For example, a jpeg file starts with ffd8 ffe0 0010 4a46 4946 0001 0101 0047 ......JFIF.....G ffd8 shows that it's a JPEG file, and ffe0 identify a JFIF type structure. There is an ascii encoding of "JFIF" which comes after a length code, but that is not necessary in order to identify the file. The first 4 bytes do that uniquely.

This gives an ongoing list of file-type magic numbers.

Image Files

@leommoore
leommoore / S3Cmd.md
Last active May 25, 2022 11:14
S3Cmd

S3Cmd - S3 Command Line Tools

S3cmd is a free command line tool and client for uploading, retrieving and managing data in Amazon S3 and other cloud storage service providers that use the S3 protocol, such as Google Cloud Storage or DreamHost DreamObjects. It is best suited for power users who are familiar with command line programs. It is also ideal for batch scripts and automated backup to S3, triggered from cron, etc.

S3cmd is written in Python. It's an open source project available under GNU Public License v2 (GPLv2) and is free for both commercial and private use. You will only have to pay Amazon for using their storage.

It is available on http://s3tools.org/s3cmd

Installing S3Cmd

@leommoore
leommoore / ssl_basics.md
Last active May 9, 2018 16:39
SSL Basics

#SSL Basics

Secure Socket Layer (SSL) is a mechanism to allow information to be securely communicated. Specifically, it is a cryptographic protocol that enables two parties such as a web server and a browser to exchange information securely by encrypting it before sending and decrypting it upon receipt. It is based on the X.509 standards.

##Symmetric and Asymmetric Encryption Encrypting and decrypting requires a secret like a password, which is known as a key. There are two types of key, symmetric and asymmetric. If a symmetric key is used it means that the same key is used to encrypt and decrypt the message. Asymmetric keys consist of a private and public key. The message sender encrypts the message using their private (secret) key and the message receiver can decrypt the message using the senders public key.

Asymmetric keys require more processing resources than symmetric keys. The problem is that to communicate using symmetric keys both parties have to have the symmetric keys first and the question is

@leommoore
leommoore / nano_js_syntax_highlighting.md
Last active October 5, 2023 21:21
nano javascript syntax highlighting

#nano javascript syntax highlighting

The existing syntax highlighting is located in /usr/share/nano/

To add a new language

sudo nano /usr/share/nano/javascript.nanorc

Put the following in the contents:

@leommoore
leommoore / JavascriptCalculatingStandardDeviations.md
Last active May 25, 2022 11:19
Javascript - Calculating Standard Deviations

Javascript - Calculating Standard Deviations

This is based on a excellent post by Derick Bailey.

function standardDeviation(values){
  var avg = average(values);
  
 var squareDiffs = values.map(function(value){
@leommoore
leommoore / ubuntu_adding_ca_certs.md
Created June 21, 2014 17:19
Ubuntu - Adding CA Certs

#Ubuntu - Adding CA Certs

To add new Certificate Authority (CA) certs:

  1. Create a directory (ie extra) in the ca-certs to hold the new certs

    sudo mkdir /usr/share/ca-certificates/extra

  2. Copy or move the certs into the new directory