Skip to content

Instantly share code, notes, and snippets.

View aduzsardi's full-sized avatar
🛠️
d(0_0)b

Alexandru Duzsardi aduzsardi

🛠️
d(0_0)b
View GitHub Profile
@aduzsardi
aduzsardi / slack_slash_cmd.py
Created December 3, 2019 12:29 — forked from devStepsize/slack_slash_cmd.py
Server-side logic to handle a Slack slash command using Python and Flask
'''
This is an example of the server-side logic to handle slash commands in
Python with Flask.
Detailed documentation of Slack slash commands:
https://api.slack.com/slash-commands
Slash commands style guide:
https://medium.com/slack-developer-blog/slash-commands-style-guide-4e91272aa43a#.6zmti394c
'''
@aduzsardi
aduzsardi / mailhog-install.md
Created October 10, 2019 08:40 — forked from viktorpetryk/mailhog-install.md
MailHog installation on Ubuntu

Install & Configure MailHog

  1. Download and make it executable
wget https://github.com/mailhog/MailHog/releases/download/v1.0.0/MailHog_linux_amd64
sudo cp MailHog_linux_amd64 /usr/local/bin/mailhog
sudo chmod +x /usr/local/bin/mailhog
  1. Make MailHog as a service
@aduzsardi
aduzsardi / access.lua
Created September 30, 2019 09:33 — forked from crisidev/access.lua
Nginx Lua script redis based for Basic user authentication
function password_encode(password)
local bcrypt = require 'bcrypt'
return bcrypt.digest(password, 12)
end
function check_password(password, encoded_password)
local bcrypt = require 'bcrypt'
return bcrypt.verify(password, encoded_password)
end
@aduzsardi
aduzsardi / apt.conf
Created September 27, 2019 09:47 — forked from zedtux/apt.conf
Nginx configuration for reprepro
server {
listen *:80;
server_name repository.votre-serveur.com;
server_tokens off;
root /srv/reprepro;
autoindex on; # Permet de voir les fichiers. Commentez la ligne pour l'interdire.
access_log /var/log/nginx/repository.votre-serveur.com_access.log;
error_log /var/log/nginx/repository.votre-serveur.com_error.log;
}
@aduzsardi
aduzsardi / modrewrite-htaccess
Created September 17, 2019 20:11 — forked from tsertkov/modrewrite-htaccess
Print mod_rewrite server variables using special mod_rewrite rules exporting internal variables via environment variables and PHP script printing there vars.
RewriteEngine On
# special mod_rewrite variables
RewriteRule .* - [E=MR_SPECIALS_API_VERSION:%{API_VERSION},NE]
RewriteRule .* - [E=MR_SPECIALS_THE_REQUEST:%{THE_REQUEST},NE]
RewriteRule .* - [E=MR_SPECIALS_REQUEST_URI:%{REQUEST_URI},NE]
RewriteRule .* - [E=MR_SPECIALS_REQUEST_FILENAME:%{REQUEST_FILENAME},NE]
RewriteRule .* - [E=MR_SPECIALS_IS_SUBREQ:%{IS_SUBREQ},NE]
RewriteRule .* - [E=MR_SPECIALS_HTTPS:%{HTTPS},NE]
@aduzsardi
aduzsardi / pem-split
Created July 26, 2019 08:22 — forked from jinnko/pem-split
Take a PEM format file as input and split out certs and keys into separate files.
#!/usr/bin/awk -f
#
# Take a PEM format file as input and split out certs and keys into separate files
#
BEGIN { n=0; cert=0; key=0; if ( ARGC < 2 ) { print "Usage: pem-split FILENAME"; exit 1 } }
/-----BEGIN PRIVATE KEY-----/ { key=1; cert=0 }
/-----BEGIN CERTIFICATE-----/ { cert=1; key=0 }
split_after == 1 { n++; split_after=0 }
/-----END CERTIFICATE-----/ { split_after=1 }
@aduzsardi
aduzsardi / README.md
Created April 11, 2019 08:35 — forked from dnozay/README.md
Enable memberOf attribute on an openldap server.
@aduzsardi
aduzsardi / parse_aws_s3_billing.py
Created February 4, 2019 17:09 — forked from oddskool/parse_aws_s3_billing.py
Simplistic script to parse the detailed AWS billing CSV file. Script displays cost of S3 operations broken down per region, bucket and usage type (either storage or network). It also sums up the amount of storage used per bucket. Output is filtered wrt to costs < 1$. See http://docs.aws.amazon.com/awsaccountbilling/latest/about/programaccess.html
# -*- coding:utf-8 -*-
'''
Simplistic script to parse the detailed AWS billing CSV file.
Script displays cost of S3 operations broken down per region, bucket and usage
type (either storage or network). It also sums up the amount of storage used per bucket.
Output is filtered wrt to costs < 1$.
See http://docs.aws.amazon.com/awsaccountbilling/latest/about/programaccess.html for
how to set up programmatic access to your billing.
@aduzsardi
aduzsardi / gist:a4903e2f54aeef044a613abe1960499c
Created January 4, 2019 09:02 — forked from scottious/gist:0d99ea77daa041b28929
__git_ps1 command not found issue.

I've been having an issue with the following error appear in the prompt after upgrading to Yosemite. The solution was to source the git bash completion and prompt files from a local copy.

    curl -o ~/.git-completion.bash https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash
    curl -o ~/.git-prompt.sh https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh

Then in:

    vi ~/bash_profile

Add:

@aduzsardi
aduzsardi / rancher_create_kubernetes_token.sh
Created November 14, 2018 14:21 — forked from superseb/rancher_create_kubernetes_token.sh
rancher_create_kubernetes_token.sh
curl 'http://<rancher_server_ip>/v2-beta/apikey' -H 'content-type: application/json' --data-binary '{"type":"apiKey","accountId":"1a1","name":"kubectl","description":"Provides workstation access to kubectl"}' --compressed | jq -r '.publicValue + ":" + .secretValue' | base64 | tr /+ _- | tr -d =