Skip to content

Instantly share code, notes, and snippets.

@Wowfunhappy
Wowfunhappy / Portfile
Last active June 6, 2021 12:28
Build Godot 3.3.2 for Mavericks
# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
PortSystem 1.0
PortGroup github 1.0
github.setup godotengine godot 3.3.2 "" -stable
revision 1
categories games graphics multimedia
platforms darwin
license MIT
@Wowfunhappy
Wowfunhappy / ChromiumMavericksWorkarounds.m
Created February 6, 2021 20:25
Compile this into a dylib and inject with DYLD_INSERT_LIBRARIES to make Chromium Legacy work on Mavericks
#import <Cocoa/Cocoa.h>
#import <AppKit/AppKit.h>
#import "ZKSwizzle.h"
#define DYLD_INTERPOSE(_replacement,_replacee) \
__attribute__((used)) static struct{ const void* replacement; const void* replacee; } _interpose_##_replacee \
__attribute__ ((section ("__DATA,__interpose"))) = { (const void*)(unsigned long)&_replacement, (const void*)(unsigned long)&_replacee };
//Left to its own devices, Mavericks CoreFoundation will release a CTFontRef which Chromium later
@Wowfunhappy
Wowfunhappy / web-sharing.sh
Last active December 4, 2020 21:18
Enable Apache
#!/bin/bash
if (( $(echo "${OSTYPE:6} > 13" | bc -l) ))
then
mkdir ~/Sites ; sudo bash -c "printf '<Directory \"/Users/`whoami`/Sites/\">\n\tAddLanguage en .en\n\tAllowOverride All\n\tOptions Indexes MultiViews FollowSymLinks\n\tRequire all granted\n</Directory>' > /etc/apache2/users/`whoami`.conf ; echo 'AddDefaultCharset utf-8' >> /etc/apache2/httpd.conf ; sed -i '' '/LoadModule userdir_module libexec\/apache2\/mod_userdir.so/s/^#*//g' /etc/apache2/httpd.conf ; sed -i '' '/LoadModule php[0-9]*_module libexec\/apache2\/libphp[0-9]*.so/s/^#*//g' /etc/apache2/httpd.conf ; sed -i '' '/Include \/private\/etc\/apache2\/extra\/httpd-userdir.conf/s/^#*//g' /etc/apache2/httpd.conf ; sed -i '' '/Include \/private\/etc\/apache2\/users\/\*.conf/s/^#*//g' /etc/apache2/extra/httpd-userdir.conf ; apachectl start"
elif (( $(echo "${OSTYPE:6} > 10" | bc -l) ))
then
mkdir ~/Sites ; sudo bash -c "printf '<Directory \"/Users/`whoami`/Sites/\">\n\tAddLanguage en .en\n\tAllowOverride All\n\tOptions Indexes MultiViews Follow
@Wowfunhappy
Wowfunhappy / patches.diff
Created August 24, 2020 20:18
Docker Machine + VMWare Fusion on Mavericks
1. Reset Macports tree to revision 9bbc6e46bc525b714dbea0d10970f29f18bcc7de
2. sudo port install Docker
3. Edit Docker-Machine port file, change version to 0.16.2 and update checksums and size to match, taking from https://github.com/macports/macports-ports/blob/c534c086278121e3f558490cb1baeb011162c93d/devel/docker-machine/Portfile
4. Add in below diff patches. Removes the error checking that actually just ends up breaking everything, see: https://github.com/docker/machine/issues/4479#issuecomment-464355478. Also disables suspend in vmware because that screws up stuff.
5. Install docker-machine, save build docker-machine and docker binaries.
//todo: handle root relative URLS. Pass in request to URLFixer and let it handle sub-functions.
addEventListener('fetch', event => {
event.respondWith(forwardRequest(event.request));
})
async function forwardRequest(req) {
var inputURL = getInputURLFromRequest(req);
var init = {
method: req.method,
addEventListener('fetch', event => {
event.respondWith(forwardRequest(event.request));
})
async function forwardRequest(req) {
var url = getURLFromRequest(req);
var init = {
method: req.method,
headers: req.headers,
body: req.body,
@Wowfunhappy
Wowfunhappy / proxy.php
Last active July 13, 2020 21:58 — forked from iovar/proxy.php
Simple PHP Proxy Script
<?
/**
* A simple PHP proxy.
* Based on https://gist.github.com/iovar/9091078
* Modified by Wowfunhappy
*
* Usage: http://path/to/proxy.php?example.com
*/
@Wowfunhappy
Wowfunhappy / app.js
Created October 1, 2019 19:21
Pebble: Create Timeline Pins When It Will Rain with DarkSky API
var darkSkyApiKey = ""
/*
In theory (untested), this app should work once you (1) add an api key from dark sky and (2) replace the three fantasy functions with real code.
*/
var UI = require('ui');
var ajax = require('ajax');
var blackStatusBar = {
@Wowfunhappy
Wowfunhappy / index.html
Last active September 13, 2019 17:11
Pebble RSS Reader Settings
<!DOCTYPE html>
<html>
<head>
<title>Pebble RSS Reader Configuration</title>
</head>
<body>
<div id="allFeedForms">
<h3>RSS Feeds</h3>
</div>
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4d36e96c-e325-11ce-bfc1-08002be10318}\0000\PowerSettings]
"ConservationIdleTime"=hex:ff,ff,ff,ff
"PerformanceIdleTime"=hex:ff,ff,ff,ff
"IdlePowerState"=hex:00,00,00,00