Skip to content

Instantly share code, notes, and snippets.

@francoisfernando
francoisfernando / README.md
Created July 4, 2021 11:26 — forked from developius/README.md
Setup SSH keys for use with GitHub/GitLab/BitBucket etc

Create a new repository, or reuse an existing one.

Generate a new SSH key:

ssh-keygen -t rsa -C "[email protected]"

Copy the contents of the file ~/.ssh/id_rsa.pub to your SSH keys in your GitHub account settings (https://github.com/settings/keys).

Test SSH key:

@francoisfernando
francoisfernando / Spark and PySpark 2.4.4 Hadoop 2.9.2 and Kubernetes Support.md
Last active February 20, 2020 12:12
Building Spark docker image with user chosen hadoop version and Kubernetes support from Source distribution

Get the source distribution from Spark Github releases page. Extract it somewhere. Following was tested on MacOS.

# Run following script from root of extracted directory
./dev/make-distribution.sh --name spark-2.4.4-hadoop-2.9.2 --pip --tgz -DskipTests -Psparkpy -Phadoop-2.9 -Dhadoop.version=2.9.2 -Pkubernetes

This will build a .tgz binary distribution at root of extracted directory. Extract the binary distibution locally.

@francoisfernando
francoisfernando / ssl-testing.md
Created May 20, 2019 21:28 — forked from monodot/ssl-testing.md
Using openssl to test an SSL connection with a CA file, pulled out from a Java keystore

Java, do you trust me? 🤔

Using openssl to test an SSL connection to google.com, using a CA file that's been pulled out from a Java keystore. For those days when you want to verify that you've got the right certificate in the store:

  1. Download the Equifax root certificate (which is the root CA for Google)
  2. Import the certificate into a new Java keystore
  3. Export the certificate back out again
  4. Convert the certificate to PEM
  5. Use openssl to test an SSL connection to Google with that cert
@francoisfernando
francoisfernando / gist:66f62fe1670fdfbfc61c70fc33515ab0
Created May 17, 2019 07:43 — forked from wrouesnel/gist:6240468b75c6d72053ed
Updating system SSL and java keystore in a docker build
# Compile and install certificates for the Java trust keystore
# and main keystore. Let's face it, this is everyone's keystore password.
# Note I install java very flatly normally.
COPY trust-certs/ /usr/local/share/ca-certificates/
RUN update-ca-certificates && \
ls -1 /usr/local/share/ca-certificates | while read cert; do \
openssl x509 -outform der -in /usr/local/share/ca-certificates/$cert -out $cert.der; \
/java/bin/keytool -import -alias $cert -keystore /java/jre/lib/security/cacerts -trustcacerts -file $cert.der -storepass changeit -noprompt; \
rm $cert.der; \
done
@francoisfernando
francoisfernando / SSLPoke.java
Created May 17, 2019 00:59 — forked from 4ndrej/SSLPoke.java
Test of java SSL / keystore / cert setup. Check the commet #1 for howto.
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import java.io.*;
/** Establish a SSL connection to a host and port, writes a byte and
* prints the response. See
* http://confluence.atlassian.com/display/JIRA/Connecting+to+SSL+services
*/
public class SSLPoke {
public static void main(String[] args) {
@francoisfernando
francoisfernando / postgres-cheatsheet.md
Created September 9, 2018 18:14 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@francoisfernando
francoisfernando / gist:d46b9debdb2f650739255c80e31c4cb2
Last active September 7, 2018 18:18 — forked from jagregory/gist:710671
How to move to a fork after cloning
So you've cloned somebody's repo from github, but now you want to fork it and contribute back. Never fear!
if you want to follow convention:
1. Fork their repo on Github
2. In your local, rename your origin remote to upstream
git remote rename origin upstream
3. Add a new origin