Skip to content

Instantly share code, notes, and snippets.

View LoveDuckie's full-sized avatar
🤓
Hacking mainframes

Luc Shelton LoveDuckie

🤓
Hacking mainframes
View GitHub Profile
@jesperdj
jesperdj / vecmath.hpp
Created June 10, 2011 17:51
Simple vector math classes with SSE-optimized implementation (C++).
/*
* Copyright 2011 Jesper de Jong
*
* 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
@ibeex
ibeex / auth.py
Created October 14, 2011 20:04
Python LDAP (ActiveDirectory) authentication
import ldap
def check_credentials(username, password):
"""Verifies credentials for username and password.
Returns None on success or a string describing the error on failure
# Adapt to your needs
"""
LDAP_SERVER = 'ldap://xxx'
# fully qualified AD user name
LDAP_USERNAME = '%s@xxx.xx' % username
@akoumjian
akoumjian / Install_nginx_from_src_with_module.sh
Created February 23, 2012 16:51 — forked from zefer/Install_nginx_from_src_with_module.sh
Compile nginx from source, include the Headers More module - Ubuntu
sudo su -
# stuff we need to build from source
apt-get install libpcre3-dev build-essential libssl-dev
# get the nginx source
cd /opt/
wget http://nginx.org/download/nginx-0.8.54.tar.gz
tar -zxvf nginx*
# we'll put the source for nginx modules in here
@fincs
fincs / main.cpp
Created May 19, 2012 22:37
Fully native C++ WinRT (Metro-style) app
//
// Fully native C++ WinRT application example
// Programmed by fincs
//
#include <windows.h>
#include <roapi.h>
#include <wchar.h>
#include <stdio.h>
#include <stdlib.h>
@ibeex
ibeex / foo.log
Created August 4, 2012 13:46
Flask logging example
A warning occurred (42 apples)
An error occurred
@femmerling
femmerling / authenticate.py
Last active June 13, 2022 17:18
I have to create user authentication using python-ldap. After googling around and trying out stuffs, this is the final code for you to use. Please remember to adjust the user_dn, and base_dn accordingly to the format used in your LDAP server.
# to be able to import ldap run pip install python-ldap
import ldap
if __name__ == "__main__":
ldap_server="x.x.x.x"
username = "someuser"
password= "somepassword"
# the following is the user_dn format provided by the ldap server
user_dn = "uid="+username+",ou=someou,dc=somedc,dc=local"
@CartBlanche
CartBlanche / gist:5227548
Last active May 20, 2016 12:25
C++ DirectXTK vs C# XNA/MonoGame
For example do you prefer this C++ DirectXTK code:
std::unique_ptr<DirectX::SpriteBatch> m_pSpriteBatch;
m_pSpriteBatch = std::unique_ptr<DirectX::SpriteBatch>(new DirectX::SpriteBatch(m_d3dContext.Get()));
Or do you prefer this C# XNA/MonoGame code...
SpriteBatch _spriteBatch;
_spriteBatch = new SpriteBatch(graphicsDevice);
@yutopio
yutopio / tree.cs
Created May 24, 2013 14:18
AVL Tree implemenation in C#
using System;
using System.Collections;
using System.Collections.Generic;
public class Tree<T> : ICollection<T>, IList<T> where T : IComparable<T>
{
public class TreeNode : ICollection<T>, IList<T>
{
public TreeNode(T value, Tree<T> tree)
{
@grenade
grenade / 01-generate-ed25519-ssh-key.sh
Last active April 14, 2024 14:27
generate ed25519 ssh and gpg/pgp keys and set file permissions for ssh keys and config
#!/bin/bash
# generate new personal ed25519 ssh key
ssh-keygen -o -a 100 -t ed25519 -f ~/.ssh/id_ed25519 -C "rob thijssen <rthijssen@gmail.com>"
# generate new host cert authority (host_ca) ed25519 ssh key
# used for signing host keys and creating host certs
ssh-keygen -t ed25519 -f manta_host_ca -C manta.network
eval "$(ssh-agent -s)"
@matthieuauger
matthieuauger / phpmyadmin-nginx
Created February 15, 2014 12:14
Nginx & PHP-FPM configuration for phpMyAdmin
server {
listen 80;
server_name phpmyadmin.yourdomain.com;
access_log /var/log/nginx/phpmyadmin_access.log;
error_log /var/log/nginx/phpmyadmin_error.log;
root /usr/share/phpmyadmin;
index index.php;