Skip to content

Instantly share code, notes, and snippets.

View rgherta's full-sized avatar
🥴

Roman Gherta rgherta

🥴
View GitHub Profile
@rgherta
rgherta / history.txt
Last active December 14, 2020 23:58
history
# create ca.key and ca.crt
openssl genrsa -out ./ca/ca.key 2048
openssl req -new -x509 -days 1825 -key ./ca/ca.key -out ./ca/ca.crt --config ca.cnf
#openssl x509 -in ca.crt -text -noout
# creates domain.key and domain.csr
openssl req -new -out ./certs/domain.csr -config domain.cnf
#openssl req -in ./certs/domain.csr -text -noout
@rgherta
rgherta / domain.cnf
Last active January 20, 2021 10:35
Simple domain.cnf
[ req ]
# This specifies the default key size in bits. If not specified then 512 is
# used. It is used if the -new option is used. It can be overridden by using
# the -newkey option.
default_bits = 2048
# This is the default filename to write a private key to. If not specified the
# key is written to standard output. This can be overridden by the -keyout
# option.
default_keyfile = ./certs/domain.key
@rgherta
rgherta / ca.cnf
Last active January 20, 2021 10:36
simple private ca
# Creating a Private Certificate Authority
# https://www.feistyduck.com/library/openssl-cookbook/online/ch-openssl.html
# Template https://github.com/ivanr/bulletproof-tls/blob/master/private-ca/root-ca.conf
# The first part of the configuration file contains some basic CA information, such as the name and the base URL, and the components of the CA’s distinguished name. Because the syntax is flexible, information needs to be provided only once:
[default]
name = ca
default_ca = ca_default
name_opt = utf8,esc_ctrl,multiline,lname,align
@rgherta
rgherta / gist:cf8c0feb0d9c6ec6cabce14c99609bdd
Created June 3, 2017 14:26
Python function for replacing values in a word template and save as pdf
#FUNCTION DEFINITION
def saveInvoice(templateName, saveWithName, valuesDictionary):
word = win32.gencache.EnsureDispatch('Word.Application')
word.Visible = False
myTemplate = word.Documents.Open(templateName)
for key in valuesDictionary:
find = word.Selection.Find
find.Text = key
find.Replacement.Text = valuesDictionary[key]
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@rgherta
rgherta / addin.xlam
Last active January 19, 2017 12:46
Custom Addin with Ribbon in Excel
#Rels
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
<Relationship Id="rId7" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties" Target="docProps/app.xml"/>
<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="xl/workbook.xml"/>
<Relationship Id="rId6" Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="docProps/core.xml"/>
<Relationship Id="rId5" Type="http://schemas.microsoft.com/office/2006/relationships/ui/extensibility" Target="customUI/customUI.xml"/>
</Relationships>
@rgherta
rgherta / httprequest.xlsm
Last active January 19, 2017 12:48
HTTP request in VBA
'Using Microsoft XML, v6.0
Sub postrequest()
Dim conn As New XMLHTTP60
conn.Open "post", "https://duckduckgo.com/?q=hello", False
conn.send
def found(tbf,lt):
found=False
for i in range(0,len(lt)+1-len(tbf)):
if lt[i:i+len(tbf)] == tbf:
found = True
return found
inlist = [3,5,6,7,2,1,3,4,1,7,7,7,8,9]
tbf = [1,3,4]