Skip to content

Instantly share code, notes, and snippets.

@dnozay
dnozay / LICENSE
Last active July 10, 2016 19:04
Reads a JPG filename as input, outputs the date (extracted from exif metadata).
The MIT License (MIT)
Copyright (c) 2016 Damien Nozay
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files
(the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
@dnozay
dnozay / formatStackTraceString.scala
Created June 30, 2016 20:04
formatting an exception.
// http://stackoverflow.com/questions/1149703/how-can-i-convert-a-stack-trace-to-a-string
def formatStackTraceString(t: Throwable): String = {
s"""
| exception: ${t.getClass.getName}
| message: ${t.getMessage}
| cause: ${t.getCause}
| stacktrace:
| ${indent(t.getStackTraceString, spaces = 4)}
""".stripMargin
@dnozay
dnozay / README.md
Created October 7, 2015 18:12
Example on how to print a traceback and ignore low-level calls.
@dnozay
dnozay / no-SSL3-poodleattack.ldif
Created July 22, 2015 03:21
LDAP disable SSL3 poodle attack
dn: cn=config
changetype: modify
add: olcTLSCipherSuite
olcTLSCipherSuite: SECURE256:-VERS-SSL3.0
@dnozay
dnozay / test_email.py
Created July 22, 2015 03:17
test email script (using python)
#!/usr/bin/env python
# simple script to test that email (internal relay) is working.
import smtplib
import argparse
from uuid import uuid4
from email.mime.text import MIMEText
def smtp_mail(subject, message, addr_from, addr_to, smtp_host):
msg = MIMEText(message.encode('utf-8'), 'plain', 'utf-8')
@dnozay
dnozay / centos-minion.ks
Created July 22, 2015 03:14
centos 6 kickstart file.
install
#cmdline
text
skipx
reboot --eject
# we're using a VM
unsupported_hardware
# please remember to change this
@dnozay
dnozay / sshd_config
Created July 22, 2015 02:47
public-key only sshd config.
# /etc/ssh/sshd_config
# Everything is going to be public-key based.
# And we want to lock down the system from unauthorized access.
# Use only protocol 2
Protocol 2
# Using public-key, one try is enough. Must present the correct key.
MaxAuthTries 1
@dnozay
dnozay / README.md
Last active May 26, 2017 16:50
docker tips and tricks

fix slow networking

see hashicorp/vagrant#1807

boot2docker down
VBoxManage modifyvm "boot2docker-vm" --natdnsproxy1 on
VBoxManage modifyvm "boot2docker-vm" --natdnshostresolver1 on
boot2docker up
@dnozay
dnozay / test_ldap.py
Created May 13, 2015 17:25
python-ldap simple test script
#!/usr/bin/env python
import ldap, sys
LDAP_SERVER = 'ldaps://ldap.example.com:636'
LDAP_BASE = 'dc=example,dc=com'
try:
conn = ldap.initialize(LDAP_SERVER)
except ldap.LDAPError, e:
@dnozay
dnozay / README.md
Last active February 23, 2024 15:06
Enable memberOf attribute on an openldap server.