Skip to content

Instantly share code, notes, and snippets.

View kevingduck's full-sized avatar

Kevin Duck kevingduck

  • Expel
View GitHub Profile
@kevingduck
kevingduck / install_and_run.sh
Created October 21, 2023 01:05
memGPT app installation script
#!/bin/bash
# Clone the repo
git clone https://github.com/cpacker/MemGPT.git
cd MemGPT/main || { echo "Directory MemGPT/main does not exist. Exiting."; exit 1; }
# Check for Python 3
if ! command -v python3 &>/dev/null; then
echo 'Python 3 is not installed. Exiting.'
exit 1
fi
name: Label Templated Issue
on:
issues:
types: [created]
jobs:
label-templated-issue:
runs-on: ubuntu-latest
@kevingduck
kevingduck / Swarm.py
Created August 16, 2017 06:32
Swarm.py
'''
A swarm simulation based on the 'Boids' algorithm by Craig Reynolds (http://www.red3d.com/cwr/boids/) and pseudo-code by Conrad Parker (http://www.kfish.org/boids/pseudocode.html)
You can tap the screen to scatter the swarm temporarily.
'''
from scene import *
import sound
from random import uniform, choice
import math
@kevingduck
kevingduck / Recent Tweets.py
Created August 16, 2017 06:31
Recent Tweets.py
# coding: utf-8
import twitter
def main():
accounts = twitter.get_all_accounts()
if not accounts:
print('No Twitter accounts were found. You can configure Twitter accounts in the settings app. If you have denied access to your accounts when prompted, you can also change your mind there.')
account = accounts[0]
username = account['username']
print('Loading recent tweets in %s\'s timeline...' % (username,))
@kevingduck
kevingduck / Random MIDI Melody.py
Created August 16, 2017 06:31
Random MIDI Melody.py
#! python2
# NOTE: The first line in this script specifies that it should always be run using Python 2.7.
# The `midiutil` module is currently not available for Python 3.
'''Generates a MIDI file with 12 random notes in C major, using the midiutil module. The instrument is also picked randomly. The result is then played with the sound.MIDIPlayer class.
If nothing happens, make sure that your device isn't muted.
'''
from midiutil.MidiFile import MIDIFile
@kevingduck
kevingduck / Image Effects.py
Created August 16, 2017 06:30
Image Effects.py
'''
A couple of simple image filter demos using PIL/Pillow.
'''
from PIL import Image, ImageOps, ImageFilter
from PIL.Image import BILINEAR
from math import sqrt, sin, cos, atan2
import dialogs
import photos
@kevingduck
kevingduck / Calculator.py
Created August 16, 2017 06:30
Calculator.py
# coding: utf-8
from __future__ import division
import ui
import clipboard
from console import hud_alert
shows_result = False
def button_tapped(sender):
@kevingduck
kevingduck / Subplot Demo.py
Created August 16, 2017 06:29
Subplot Demo.py
# coding: utf-8
# Simple demo with multiple subplots.
import numpy as np
import matplotlib.pyplot as plt
x1 = np.linspace(0.0, 5.0)
x2 = np.linspace(0.0, 2.0)
@kevingduck
kevingduck / Simple Plot.py
Created August 16, 2017 06:28
Simple Plot.py
# coding: utf-8
from pylab import *
t = arange(0.0, 2.0, 0.01)
s = sin(2*pi*t)
plot(t, s)
xlabel('time (s)')
ylabel('voltage (mV)')
title('About as simple as it gets, folks')
@kevingduck
kevingduck / Pie Chart Demo.py
Created August 16, 2017 06:28
Pie Chart Demo.py
# coding: utf-8
'''
Demo of a basic pie chart plus a few additional features.
In addition to the basic pie chart, this demo shows a few optional features:
* slice labels
* auto-labeling the percentage
* offsetting a slice with "explode"
* custom start angle