Skip to content

Instantly share code, notes, and snippets.

ldapdb = collections.namedtuple("namespace", ['person', 'group', 'share', 'maillist'])
ldapdb.person = ldap_to_pandas(ldap.search(filter="(&(objectClass=univentionPerson))", base=common.ucs_access.base_dn()))
ldapdb.group = ldap_to_pandas(ldap.search(filter="(&(objectClass=univentionGroup))", base=common.ucs_access.base_dn()))
ldapdb.share = ldap_to_pandas(ldap.search(filter="(&(objectClass=univentionShare))", base=common.ucs_access.base_dn()))
ldapdb.maillist = ldap_to_pandas(ldap.search(filter="(&(objectClass=univentionMailList))", base=common.ucs_access.base_dn()))
@wariw
wariw / mpv.conf
Created April 28, 2015 19:48
mpv.conf
# Video
#vo = opengl-hq,direct3d
# vo=opengl-hq:interpolation:scale=ewa_lanczos:cscale=ewa_lanczos:tscale=mitchell:scaler-resizes-only:dither-depth=8:temporal-dither:waitvsync:pbo
vo=opengl-hq:interpolation:scale=haasnsoft:cscale=haasnsoft:source-shader=[D:\Documents\mpvhq\deband.glsl]:tscale=mitchell:dscale=triangle:scaler-resizes-only:dither-depth=8:temporal-dither:waitvsync:pbo
# Audio
ao = wasapi,dsound,openal
alang = jpn,jap,jp,Japanese,en,eng,English
# Subtitles
@nitaku
nitaku / README.md
Last active October 6, 2020 07:33
Cola.js layout

A simple exercise with cola.js. A node-link diagram is displayed, based on positions computed by cola's fast-converging constraints-based layout algorithm. Handling of more than one connected component, node dragging and non-overlapping constraints are also shown.

Compare with a similar example using native d3.js force-directed layout.

import AWSS3
class S3Uploader: NSObject, NSURLSessionDelegate, NSURLSessionTaskDelegate, NSURLSessionDataDelegate {
var urlSession: NSURLSession?
var uploadTask: NSURLSessionUploadTask?
var url: String?
var filename: String?
var callback: ((Bool, String?) -> Void)? = nil;
//This needs to Deinit when unwind segue, but right now it only deinits sometimes !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@izotx
izotx / upload.swift
Last active September 23, 2018 22:58
Uploading Image to Server
static func uploadImage(image:UIImage,token:String, imageType:String, callback:((message:String?, error:String?)->Void))->NSURLSessionTask{
var imageData = UIImagePNGRepresentation(image)
var request = NSMutableURLRequest(URL: NSURL(string:APIKeys.url.rawValue)!)
request.cachePolicy = NSURLRequestCachePolicy.ReloadIgnoringLocalAndRemoteCacheData
var session = NSURLSession.sharedSession()
request.HTTPMethod = "POST"
@loderunner
loderunner / osx-ld.md
Last active April 26, 2024 13:53
potential blog posts

ld – Wading through Mac OS X linker hell

Intro

Friend: I tried looking at static linking in Mac OS X and it seems nearly impossible. Take a look at this http://stackoverflow.com/a/3801032

Me: I have no idea what that -static flag does, but I'm pretty sure that's not how you link to a library. Let me RTFM a bit.

Minutes later...

#include <stdio.h>
#include <windows.h>
static CALLBACK DWORD read_thread(void *arg)
{
HANDLE pipe = arg;
OVERLAPPED ol = { .hEvent = CreateEventW(NULL, TRUE, TRUE, NULL) };
HANDLE out = GetStdHandle(STD_OUTPUT_HANDLE);
char outbuf[128];
@xem
xem / readme.md
Last active April 5, 2024 23:16
Maths & trigonometry cheat sheet for 2D & 3D games

Conventions

  • A = [xA, yA] is a point on the 2D plane. Same for B, C, ...
  • lengths are in any unit (ex: pixels)
  • code snippets are in JavaScript

Degrees to radians

angleRad = angleDeg * Math.PI / 180;

#include <stdio.h>
#include <string.h>
#include <windows.h>
static CALLBACK DWORD discard_thread(void *arg)
{
HANDLE pipe = arg;
OVERLAPPED ol = { 0 };
ol.hEvent = CreateEventW(NULL, TRUE, TRUE, NULL);
@pudquick
pudquick / receipts.py
Created August 18, 2016 17:14
Programmatically access package receipt information using the OS X PrivateFramework PackageKit (same one pkgutil uses) with python and pyobjc
import objc
packagekit_bundle = objc.loadBundle('PackageKit', module_globals=globals(), bundle_path='/System/Library/PrivateFrameworks/PackageKit.framework', scan_classes=False)
PKReceipt = objc.lookUpClass('PKReceipt')
receipts = PKReceipt.receiptsOnVolumeAtPath_('/')
first_receipt = receipts[0]
# Things you can look up:
# installPrefixPath