Skip to content

Instantly share code, notes, and snippets.

View _README.md

How to use:

  1. (On a mac) Launch "Script Editor"
  2. Change the language to javascript if needed
  3. Paste the code from wine-launcher.jxa
  4. Save with the file format "Application", and uncheck "Show startup screen" and "Stay open after run handler" (I recommend putting it in your user/Applications directory)
  5. Make sure wine is installed, you can use homebrew
  6. Right click an ".exe" file, choose "Get Info", and then change the "Open with" application to your Wine app that you just made. To make it work for all .exe files, click "Change All…" afterward.

Now you can double click any exe and it'll launch in wine :)

@jiaaro
jiaaro / hexcolor.lua
Last active Jul 1, 2020
Hex colors to love2d
View hexcolor.lua
-- converts CSS-style hex colors to love2d 0 - 1 scaled colors
-- e.g., hexcolor("ccff99") == {0.8, 1.0, 0.6}
-- supports alpha, e.g., hexcolor("ccff9966") == {0.8, 1.0, 0.6, 0.4}
-- supports shorthand, e.g., hexcolor("cf96") == hexcolor("ccff9966")
-- automatically strips common prefixes, e.g., hexcolor("#cf9"), hexcolor("0xcf9")
export function hexcolor(c)
-- strip leading "#" or "0x" if necessary
if c:sub(1, 1) == "#" then
c = c:sub(2)
elseif c:sub(1,2) == "0x" then
@jiaaro
jiaaro / konami.lua
Last active Jun 8, 2020
Love2d Konami Code module
View konami.lua
--[[
Example use:
function love.keypressed(key)
konami(key, function()
love.window.showMessageBox("Konami", "the konami code was entered")
end)
end
]]
local MAX_DELAY = 1.5
View asyncio_example.py
import asyncio
async def sum_queue_vals(q):
result = 0
while True:
val = await q.get()
if val is None:
break
result += val
return result
@jiaaro
jiaaro / setup_local_codebuild_testing.sh
Last active Mar 27, 2020
Set up local testing for codebuild
View setup_local_codebuild_testing.sh
#!/bin/bash
docker --version
if [[ $? != 0 ]]; then
brew cask install docker
fi
echo "Make sure you have $HOME/bin in your PATH"
mkdir -p ~/bin/
curl https://raw.githubusercontent.com/aws/aws-codebuild-docker-images/master/local_builds/codebuild_build.sh > ~/bin/codebuild_build.sh
@jiaaro
jiaaro / async_children_with_cleanup.sh
Last active May 21, 2020
Run some commands asynchronously in bash and then make sure to kill the child processes if the user kills the process with CTRL-C (or similar)
View async_children_with_cleanup.sh
#!/bin/bash
trap "exit" INT TERM # Convert INT and TERM to EXIT
trap "kill 0" EXIT # Kill all children if we receive EXIT
# Run stuff in the background
sleep 3 &
sleep 4 &
# Find child processes and wait for them to finish so this script doesn't
View pydub_mixer.py
from pydub import AudioSegment
from pydub.utils import db_to_float
# note: see usage example at the bottom of the gist :)
class Mixer(object):
def __init__(self):
self.parts = []
def overlay(self, sound, position=0):
View combining_mono_audiosegments.py
In [1]: paste
import array
from pydub import AudioSegment
from pydub.generators import Sine, Square
# make two mono sounds (300 Hz tones)
sound1 = Sine(300).to_audio_segment(duration=30000)
sound2 = Square(300).to_audio_segment(duration=30000)
def x():
View App Revenue Output.md

If you've ever wondered what it's be like to "go indie" here is a script with some assumptions that might help you project your income.

Assumptions:

  • You will make a new app every month
  • Apps have a useful life of 3 years (after that they stop earning money)
  • Apps will earn $250 in their launch month
  • Apps will earn $100/mo at first (starting month 2), but that revenue will slowly decline (~50% each year)
  • As you make more apps your brand/mailing list will start to pay dividends (after 4 apps you'll see the numbers above double, after 8 they'll 3x, and so on)

So how would that work out?

View keybase.md

Keybase proof

I hereby claim:

  • I am jiaaro on github.
  • I am jiaaro (https://keybase.io/jiaaro) on keybase.
  • I have a public key ASAmjWlR2gGlcJGuKzzPQ4UDqxXW0WeP-NDoJACLKWKo7go

To claim this, I am signing this object:

You can’t perform that action at this time.