Skip to content

Instantly share code, notes, and snippets.

@GiantRobato
GiantRobato / self-serve.md
Last active February 6, 2020 02:09
Self Serve SSL gitlab

Instructions

After you create your cert + cert key, enable by updating nginx

sudo gitlab-ctl hup nginx

Old instructions

@GiantRobato
GiantRobato / self-signed-certificate-with-custom-ca.md
Last active February 6, 2020 01:22 — forked from fntlnz/self-signed-certificate-with-custom-ca.md
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

Generate Cert folder

mkdir -p root-ca/{certreqs,certs,crl,newcerts,private}

Create Root Key

@GiantRobato
GiantRobato / APURE_FS_Create_dir.gz
Created January 30, 2020 05:09
APUE File System Create Directory
digraph G {
CG [
shape=plaintext
label=<
<table border='0' cellborder='1' cellspacing='0'>
<tr>
<td>CG</td>
<td>...</td>
@GiantRobato
GiantRobato / APUE_FS.gz
Last active January 30, 2020 04:08
[APUE ] File System Gist
digraph G {
Disk [
shape=plaintext
label=<
<table border='0' cellborder='1' cellspacing='0'>
<tr>
<td>Disk</td>
<td port='one'>Partition 1</td>
<td port='two'>Partition 2</td>
@GiantRobato
GiantRobato / install_missing_pkgs.py
Last active May 2, 2019 17:01
How to install missing packages in notebooks
import sys
!{sys.executable} -m pip install requests
@GiantRobato
GiantRobato / backup_jenkins.md
Last active April 3, 2019 18:33
backup jenkins home when running in docker

Backup Jenkins

If you want to backup your jenkins_home folder, after you start it with docker:

docker run -p 8080:8080 -p 50000:50000 --name jenkins jenkins/jenkins

Backup the jenkins home folder locally via docker <container name>:<folder path> <out_dir>

@GiantRobato
GiantRobato / readPNG.py
Created August 4, 2018 04:53
reads a 1 pixel png file as a binary file and looks at the data contained inside
from __future__ import print_function
import struct
import zlib
with open('./whitePixel.png','rb') as f:
PNGheader = f.read(8)
while True:
chunk = f.read(4)
if not chunk: break
@GiantRobato
GiantRobato / unpackIDAT.py
Created August 4, 2018 04:42
unpacks rgb data using python
import zlib
import struct
#in while loop
try:
chunkType = bytes(chunkType).decode('utf-8')
if chunkType == 'IDAT':
deflated = zlib.decompress(data)
(a,r,g,b) = struct.unpack('<BBBB',deflated)
print('argb value is: [{},{},{},{}]'.format(a,r,g,b))
@GiantRobato
GiantRobato / readBinary.py
Created August 4, 2018 04:21
reads through all the chunks of a png file
while True:
chunk = f.read(4)
if not chunk: break
chunkType = f.read(4)
numBytes = int.from_bytes(chunk, byteorder='big')
data = f.read(numBytes)
crc = f.read(4)
print(chunkType)
print(data)