{{ message }}

Instantly share code, notes, and snippets.

# James Robert jiaaro

Created Apr 10, 2016
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?

Created Mar 20, 2016
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:

Last active Mar 16, 2016
Calculate the value of your investments and savings at some point in the future
View investment_calculator.py
 class Investment(object): def cash_invested_by_month(self, month): raise NotImplementedError def value_in_month(self, month): raise NotImplementedError class SingleInvestment(Investment): def __init__(self, amount, monthly_interest_rate, month=0):
Last active Jan 4, 2016
NOTE: organism.py belongs in a directory "breeder"
View organism.py
 #!/usr/bin/env python import ast from os.path import isfile from hashlib import md5 from random import randint, choice from glob import glob import re # scratch area """
Last active Jun 12, 2021
Using Swift libraries in Python
View _INSTRUCTIONS.md

## Using Swift libraries in Python

So... this is obviously totally, 100%, like for. real. not. supported. by. Apple. …yet?

But still... I thought it was pretty badass. And, seeing how there's already a Swift buildpack for Heroku you could move some slow code into Swift can call it as a library function. But, you know, not in production or anything. That would be silly, right?

Now, having said that, the actual Python/Swift interop may have bugs. I'll leave that as an exercise to the reader.

### How to get Python code calling Swift functions:

Created Jul 29, 2015
View gist:89a7427a1dfabbb6c213

Last active Aug 29, 2015
formset example code
View forms.py
 class MyForm(forms.Form): is_interesting = forms.BooleanField(required=False) def __init__(self, *args, **kwargs): self.object = kwargs['initial']['obj'] super(MyForm, self).__init__(*args, **kwargs) def save(self): ...
Created May 23, 2015
Make a chord progressions
View chord_pregression_player.py
 from pydub import AudioSegment from pydub.generators import Sine, Square, WhiteNoise from pydub.playback import play # From https://gist.github.com/jiaaro/339df443b005e12d6c2a def note_to_freq(note, concert_A=440.0): ''' from wikipedia: http://en.wikipedia.org/wiki/MIDI_Tuning_Standard#Frequency_values ''' return (2.0 ** ((note - 69) / 12.0)) * concert_A
Created May 6, 2015
ujson timings
View timings.py
 # Timings taken on a MacBook Pro (Retina, 15-inch, Mid 2014) # running OS X 10.10.3 In [1]: import sys In [2]: print sys.version 2.7.6 (default, Sep 9 2014, 15:04:36) [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] In [3]: data = [{str(x): y+z for x in range(10) for y in range(50)} for z in range(500)] In [4]: import json
Created Mar 19, 2015
Super simple BPM detection with pydub
View bpm_detection.py
 from pydub import AudioSegment from pydub.silence import detect_nonsilent seg = AudioSegment.from_file("./ghosts_and_stuff.m4a") # reduce loudness of sounds over 120Hz (focus on bass drum, etc) seg = seg.low_pass_filter(120.0) # we'll call a beat: anything above average loudness beat_loudness = seg.dBFS