Skip to content

Instantly share code, notes, and snippets.

🤖

Andre LaBranche dreness

🤖
Block or report user

Report or block dreness

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@miabrahams
miabrahams / FfmpegPostprocess.py
Last active Jul 17, 2019
Ffmpeg post-processing OBS Plugin
View FfmpegPostprocess.py
import obspython as obs
import subprocess
import os
import re
import datetime
# Info for potential OBS Python hackers!
# Tip 1 - Read the "OBS Studio Backend Design" documentation page. Read the documentation table of contents.
# Tip 2 - be sure to add obspython.py to your script path to enable completion.
# Tip 3 - Some of the Python API is generated at runtime, so it won't show up in obspython.py.
@pudquick
pudquick / heyheyhey.py
Last active Apr 13, 2019
Example of using nibbler to make an annoying window that re-focuses itself to the front every second
View heyheyhey.py
from nibbler import *
from Foundation import NSTimer, NSObject
from AppKit import NSApplication
n = Nibbler('/Users/frogor/Desktop/sweet.nib')
def test2():
print "hi (politely quit)"
n.quit()
@Dregu
Dregu / instant-replay-playlist.lua
Last active Apr 1, 2019
OBS-studio script to play instant replays and/or automatically add replays to VLC playlist for later
View instant-replay-playlist.lua
obs = obslua
source_name = ""
vlc_name = ""
scene_name = ""
replaying = false
autoclear = false
addall = false
replaylength = 10
instant_hotkey_id = obs.OBS_INVALID_HOTKEY_ID
add_hotkey_id = obs.OBS_INVALID_HOTKEY_ID
@gregneagle
gregneagle / fancy_defaults_read.py
Last active Nov 18, 2019
fancy_defaults_read.py: Reads a preference, prints its value, type, and where it is defined.
View fancy_defaults_read.py
#!/usr/bin/python
import os
import sys
from CoreFoundation import (CFPreferencesAppValueIsForced,
CFPreferencesCopyAppValue,
CFPreferencesCopyValue,
kCFPreferencesAnyUser,
kCFPreferencesAnyHost,
@pudquick
pudquick / sip_config.py
Created Dec 22, 2016
Querying active SIP status directly from the kernel, bypassing nvram and csrutil, via python on macOS
View sip_config.py
# An overly complicated SIP config checker
# This is a technically interesting implementation because it does not rely on csrutil
# Instead it queries the kernel directly for the current configuration status
# This means, for example, in environments where SIP has been disabled and csrutil has
# been removed or modified (say, with DYLD_LIBRARY_PATH), as long as python can run you
# can still check status
# Additionally, checking the nvram csr-active-config setting isn't accurate now with
# 10.12.2+, since running "sudo csrutil clear" deletes the variable until reboot,
@pudquick
pudquick / receipts.py
Created Aug 18, 2016
Programmatically access package receipt information using the OS X PrivateFramework PackageKit (same one pkgutil uses) with python and pyobjc
View receipts.py
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
View pipe-example.c
#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);
@xem
xem / readme.md
Last active Nov 11, 2019
Maths & trigonometry cheat sheet for 2D & 3D games
View readme.md

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;

View pipecat.c
#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];
@izotx
izotx / upload.swift
Last active Sep 23, 2018
Uploading Image to Server
View upload.swift
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"
You can’t perform that action at this time.