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
@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);
@winkel
winkel / WatermarkAdorner.cs
Created February 15, 2014 17:31
WPF Watermark as adoner
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Media;
/// <summary>
/// Adorner for the watermark
/// </summary>
internal class WatermarkAdorner : Adorner
@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;
@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
@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
@jonom
jonom / UniqueURLSegmentExtension.php
Created January 30, 2020 19:23
Unique URL Segment extension
<?php
class UniqueURLSegmentExtension extends DataExtension
{
private static $db = array(
'URLSegment' => 'Varchar(255)',
);
public function onBeforeWrite()
{
@dsolodow
dsolodow / wsl.conf
Last active May 8, 2022 19:21
wsl.conf; requires Windows 10 build 17063 or higher
# https://blogs.msdn.microsoft.com/commandline/2018/01/12/chmod-chown-wsl-improvements/
# Enable extra metadata options by default
[automount]
enabled = true
root = /mnt/
options = "case=off,metadata,umask=22,fmask=11"
mountFsTab = false
options = case=off
# Enable DNS – even though these are turned on by default, we’ll specify here just to be explicit.
@phynet
phynet / Jenkins Mac OS X configuration.md
Last active June 4, 2022 16:27
Jenkins Mac OS X configuration

Jenkins Mac OS X configuration

First, copy the plist file from (take note, that the number 1,590 may vary in each machine)

/usr/local/Cellar/jenkins/1.590

to LaunchAgent folder:

cp /usr/local/Cellar/jenkins/1.590/homebrew.mxcl.jenkins.plist /Users/medianet/Library/LaunchAgents 
@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"
@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>