Skip to content

Instantly share code, notes, and snippets.

View kageurufu's full-sized avatar
🏠
Working from home

Frank Tackitt kageurufu

🏠
Working from home
View GitHub Profile
@kageurufu
kageurufu / pycom-firmware-updater.diff
Created February 6, 2018 15:34
Tweak to pycom-firmware-updater AUR PKGBUILD to make the build nicer
diff --git a/PKGBUILD b/PKGBUILD
index 27f3ffc..dd4e5a5 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -13,9 +13,9 @@ optdepends=('python2-qscintilla-qt4: gui'
'python2-pyserial: gui'
'python2-setuptools: gui'
'python2-requests: gui')
-source=('https://software.pycom.io/findupgrade?product=pycom-firmware-updater&type=all&platform=unix&redirect=true'
+source=("pycom-firmware-updater.${pkgver}.tgz::https://software.pycom.io/findupgrade?product=pycom-firmware-updater&type=all&platform=unix&redirect=true"
@kageurufu
kageurufu / module_importer.py
Created August 30, 2017 22:05
Auto-import all files in a module
"""
Import all files and packages under a module into the calling file's
locals, and set __all__ to all imported modules
May be cpython only, due to abuse of ``inspect``
"""
import importlib
import inspect
import os
var Observable = (function(){
function O(initial) {
this._value = initial;
this._callbacks = [];
return this;
}
O.prototype = {
get: function() { return this.value; },
import ctypes
kernel32 = ctypes.windll.kernel32
CreateFileW = kernel32.CreateFileW
CloseHandle = kernel32.CloseHandle
CreateFileW.__doc__ = """HANDLE WINAPI CreateFile(
_In_ LPCTSTR lpFileName,
_In_ DWORD dwDesiredAccess,
_In_ DWORD dwShareMode,
@kageurufu
kageurufu / CLA.md
Created November 21, 2016 17:10 — forked from pjcozzi/CLA.md
CLA for MIT license

By making a contribution to any project under the organization Level Playing Field, I certify that:

(a) The contribution was created in whole or in part by me and I have the right to submit it under the MIT license; or

(b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that

@kageurufu
kageurufu / LICENSE
Last active October 21, 2016 19:04
Postgresql natural sorting using plv8
Copyright (c) 2016 Franklyn Tackitt
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:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
"""
html_to_text
Parses and converts HTML to plain text with formatting to match the original intention
For example, the following HTML would be converted as follows
<html>
<head>
<style>
@kageurufu
kageurufu / MainApplication.java
Created August 17, 2016 20:11
Fix for react-native#9319
// Add the following imports and methods in their respective places
import com.facebook.infer.annotation.Assertions;
import com.facebook.react.LifecycleState;
public class MainApplication extends Application implements ReactApplication {
protected Application getApplication() { return this; }
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
import os
from flask import Flask, request
from io import BufferedReader
import magic
app = Flask(__name__)
@app.route("/<string:filename>", methods=['PUT'])
def upload(filename):
head = request.stream.read(1024)
export default {
RpcDirection: {
UNKNOWN: 0, 0: "UNKNOWN",
RESPONSE: 1, 1: "RESPONSE",
REQUEST: 2, 2: "REQUEST",
},
TeamColor: {
NEUTRAL: 0, 0: "NEUTRAL",
BLUE: 1, 1: "BLUE",