Skip to content

Instantly share code, notes, and snippets.

View dnafication's full-sized avatar
🏔️
chill

Dina Basumatary dnafication

🏔️
chill
View GitHub Profile

Sequence of Gatsby's bootstrap lifecycle with links to source code as of v2.0.0

  1. open and validate gatsby-config (get-config-file.js)
  2. load plugins (load-plugins/index.js) from the list given in gatsby-config.js
  3. onPreBootstrap: runs onPreBootstrap if it is implemented in any plugins, for example gatsby-plugin-typography. Receives handy [apiCallArgs](https://github.com/gatsbyjs/gatsby/blob/ffd8b2d691c995c760fe380769852bcdb26a2278/packages/gatsby/src/util
version: '3'
services:
prisma:
image: prismagraphql/prisma:1.24
restart: always
ports:
- "8000:8000"
environment:
PRISMA_CONFIG: |
port: 8000

pip in corporate network

pip install [or any operation which requires internet access] fails with an exception (Caused by SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed) as it doesnt trust the CA Certificate injected by NBN proxy.

I tried following but failed:

  1. Tried installing package by trusting the http site but I believe it wouldnt work as pypi.org doesnt have http site anymore. pip install --trusted-host pypi.org or equivalent. Also tried with option --index-url
  2. Exported the NBN CA Cert from Google Chrome in .cer format. Converted .cer to .pem format by using openssl command openssl x509 -inform der -in certificate.cer -out certificate.pem and used the certificate with command pip install <package> --cert <cert file>
  3. Tried adding ENV variable called SSL_CERT_FILE=c:\path\to\cert.pem
  4. Unistalled all python versions and tried separately with python 2.7 and 3.6 separately
  5. Tried with a fresh install in a separate citrix desktop.
@dnafication
dnafication / docker-automation.py
Created December 8, 2017 05:56 — forked from yetanotherchris/docker-automation.py
Automating Docker images and containers with Python ()
'''
This script brings up the entire stack of Docker containers, removing the current ones.
Docker compose was tried for this task and it wasn't customisable enough.
Docker cloud was tried (with stack files) and was buggy (failed to launch, no logs returned).
Docker machine was tried, but it can't connect to existing servers only ones it created.
Rancher was too heavy weight for the task, as the containers are lightweight in DigitalOcean.
Kubernetes would've been too heavy weight for DigitalOcean.
It was written in Powershell and worked. But then converting it to Bash was too much effort.
Powershell for Linux is too much effort to install without a debian package (and none standard)
@dnafication
dnafication / jmeter-results.conf
Created November 30, 2017 06:07 — forked from jpotts/jmeter-results.conf
Logstash config that can be used to read in JMeter test results and store them in Elasticsearch
input {
file {
path => [ "/Users/jpotts/Documents/code/es-test/results.csv"]
}
}
filter {
if ([message] =~ "responseCode") {
drop { }
} else {
csv {
import random as r
def pick_word():
# Get the count of lines in the file
num_lines = sum(1 for L in open('sowpods.txt'))
rand_num = r.randint(1, num_lines)
# print(rand_num, num_lines)
with open('sowpods.txt') as f:
for i,L in enumerate(f):