Skip to content

Instantly share code, notes, and snippets.

@edpichler
edpichler / gist:d7daa0c26b18dca6dc49f65f8d51274c
Last active July 23, 2021 08:18 — forked from jessedearing/gist:2351836
Create a self-signed SSL certificate for Nginx
#!/bin/bash
echo "Generating an SSL private key to sign your certificate..."
openssl genrsa -des3 -out private.key 1024
echo "Generating a Certificate Signing Request..."
openssl req -new -key private.key -out myssl.csr
echo "Removing passphrase from key (for nginx)..."
cp private.key private.key.old
openssl rsa -in private.key.old -out private.key
@edpichler
edpichler / .gitconfig
Last active August 31, 2020 10:56 — forked from jeaye/.gitconfig
[user]
name = jeaye
email = <redacted>
[color]
all = true
ui = true
branch = auto
diff = auto
status = auto
[color "branch"]
@edpichler
edpichler / remove-gpg-user.sh
Created February 17, 2020 20:13 — forked from Falkor/git-crypt-rm-gpg-user.sh
Git-crypt remove user.
#!/bin/bash
#
# Script to remove GPG key from git-crypt
#
# It will re-initialize git-crypt for the repository and re-add all keys except
# the one requested for removal.
#
# Note: You still need to change all your secrets to fully protect yourself.
# Removing a user will prevent them from reading future changes but they will
# still have a copy of the data up to the point of their removal.
@edpichler
edpichler / .gitattributes
Last active March 10, 2021 13:53 — forked from 3noch/keybase+git-crypt.md
How to add a Keybase user to your repo using git-crypt
secretfile filter=git-crypt diff=git-crypt
*.key filter=git-crypt diff=git-crypt
secretdir/** filter=git-crypt diff=git-crypt
This works however:
#### build.gradle
```gradle
buildscript {
// Repository Configuration
ext.repos = {
mavenCentral()
maven { url 'https://repo.spring.io/milestone' }
@edpichler
edpichler / Flatten.kt
Last active November 21, 2018 11:07
Flat an Int Array in Kotlin.
fun flatten(numbers: Array<Any>): ArrayList<Int> {
val flattenReturn = arrayListOf<Int>()
numbers.forEach { it ->
if (it is Int) {
flattenReturn.add(it)
} else {
val temp = flatten(it as Array<Any>)
flattenReturn.addAll(temp)
}
}
@edpichler
edpichler / tools.sh
Last active June 29, 2018 02:28
Unix commands.
#Organize files by date:
for x in `find . -type f -name "*.*"` ; do
year=$(date -r "$x" +%Y)
monthyear=$(date -r "$x" +%m-%Y)
day=$(date -r "$x" +%Y-%m-%d)
foldername="$year/$monthyear/"
mkdir -p "$foldername"
mv -- "$x" "$foldername"
echo "Moving file $x to $foldername" #>> logs.txt
@edpichler
edpichler / MyWebServlet.java
Last active August 27, 2018 12:48
A Spring utility class to return the application context. Works in server applications, standalone apps and jUnit tests.
@WebServlet(name = "MyWebHook", value = "/WebHook")
public class MyWebServlet extends HttpServlet {
private MyBean byBean
= SpringUtils.INSTANCE.ctx(this, true).getBean(MyBean.class);
public MyWebServlet() {
@edpichler
edpichler / EasyPNRExample.java
Last active June 10, 2018 16:37
Get All airports with IATA codes retrieving EasyPNR Web service
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class EasyPNRExample {
/**
* https://www.easypnr.com/webservice
* @param args
<span style="left: -38px; margin-right: -38px; position: relative;" class="button btn">teste</span>