Skip to content

Instantly share code, notes, and snippets.

View jonbrennecke's full-sized avatar

Jon Brennecke jonbrennecke

View GitHub Profile
@opedge
opedge / StyleTransfer.swift
Last active July 29, 2023 21:48
CoreML style transfer with Vision (workaround while VNPixelBufferObservation.pixelBuffer is broken)
import Foundation
import UIKit
import CoreML
import Vision
// Quick and dirty example of how to fix Vision VNPixelBufferObservation BAD_ACCESS.
// Please handle errors in swift by yourself, this code sample intended only for demonstration.
// MLModel must have multiArray output and Image input.
// Before using this functions install CoreMLHelpers from https://github.com/hollance/CoreMLHelpers
@Neo23x0
Neo23x0 / wpwatcher.py
Last active November 26, 2022 15:42
Wordpress Watcher - WPScan Vulnerabilty Scan on Wordpress Sites and Reporting
#!/usr/bin/env python
# -*- coding: iso-8859-1 -*-
# -*- coding: utf-8 -*-
#
# Wordpress Watcher
# Automating WPscan to scan and report vulnerable Wordpress sites
# Florian Roth
# v0.1
# March 2015
#
@JadenGeller
JadenGeller / Swift Y Function.swift
Last active December 30, 2018 09:31
Swift Y Function
// We define a Y function such that we can use recursion within an anonymous closure
// Note that this function Y is not a combinator because it recursively refers to itself
// There's not much reason to have an actual combinator in Swift, so we're not going to
// worry about it, it's just as useful.
/*
* Takes as input a function that takes in a function and returns a function of the same type
* and returns a function of that return type by feeding that function back into itself
* infinite times. Note that we use a closure to guard looping due to applicative order evaluation.
@Fonserbc
Fonserbc / Easing.cs
Last active February 23, 2024 01:13
Compact and simple easing functions for Unity
using UnityEngine;
/*
* Most functions taken from Tween.js - Licensed under the MIT license
* at https://github.com/sole/tween.js
* Quadratic.Bezier by @fonserbc - Licensed under WTFPL license
*/
public delegate float EasingFunction(float k);
public class Easing
@karmi
karmi / .gitignore
Last active November 12, 2022 12:11
Example Nginx configurations for Elasticsearch (https://www.elastic.co/blog/playing-http-tricks-nginx)
nginx/
!nginx/.gitkeep
!nginx/logs/.gitkeep
src/
tmp/
@Tricertops
Tricertops / UIImage+MostUsedColor.m
Last active January 26, 2019 05:06
UIImage method that makes color histogram from the image and sort them by number of occurences. Clone and edit for your specific purpose.
- (NSMutableData *)mutableRGBAData {
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
CGSize scaledSize = (CGSize){
.width = self.size.width * self.scale,
.height = self.size.height * self.scale,
};
NSUInteger const bytesPerPixel = 4;
NSUInteger const bitsPerComponent = 8;
@lorenzopolidori
lorenzopolidori / has3d.js
Last active December 4, 2020 10:52 — forked from webinista/has3d.js
Testing for CSS 3D Transforms Support
function has3d(){
if (!window.getComputedStyle) {
return false;
}
var el = document.createElement('p'),
has3d,
transforms = {
'webkitTransform':'-webkit-transform',
'OTransform':'-o-transform',
@jacobbubu
jacobbubu / ioslocaleidentifiers.csv
Created February 15, 2012 14:41
iOS Locale Identifiers
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
mr Marathi
bs Bosnian
ee_TG Ewe (Togo)
ms Malay
kam_KE Kamba (Kenya)
mt Maltese
ha Hausa
es_HN Spanish (Honduras)
ml_IN Malayalam (India)
ro_MD Romanian (Moldova)
@paulirish
paulirish / rAF.js
Last active March 22, 2024 00:00
requestAnimationFrame polyfill
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
@jonleighton
jonleighton / base64ArrayBuffer.js
Last active April 19, 2024 21:54
Encode an ArrayBuffer as a base64 string
// Converts an ArrayBuffer directly to base64, without any intermediate 'convert to string then
// use window.btoa' step. According to my tests, this appears to be a faster approach:
// http://jsperf.com/encoding-xhr-image-data/5
/*
MIT LICENSE
Copyright 2011 Jon Leighton
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: