Skip to content

Instantly share code, notes, and snippets.

View ryesalvador's full-sized avatar

Rye Salvador ryesalvador

View GitHub Profile
@ryesalvador
ryesalvador / setup.py
Created August 4, 2015 06:35
A Py2exe setup.py hack for PyGame
# setup.py
from distutils.core import setup
import py2exe, sys, os
from glob import glob
# The following code is a work around hack for excluded DLLs.
origIsSystemDLL = py2exe.build_exe.isSystemDLL
def isSystemDLL(pathname):
if os.path.basename(pathname).lower() in ["sdl_ttf.dll",
@ryesalvador
ryesalvador / config.txt
Created August 4, 2015 07:15
Raspberry Pi HDMI video config for Toshiba Power TV CT-90384
# My Raspberry Pi HDMI video config for Toshiba Power TV CT-90384
disable_overscan=1
hdmi_force_hotplug=1
config_hdmi_boost=4
hdmi_drive=2
hdmi_group=2
hdmi_mode=16
@ryesalvador
ryesalvador / hackhappy
Created August 4, 2015 07:44
A bash script that keeps my Raspberry Pi wireless internet connection open
#!/bin/bash
# Script from hackhappy.org
while [ true ]
do
sleep 20
wget -q --spider http://www.google.com/
if [ "$?" != 0 ]; then
sudo ifdown wlan0 && sudo ifup wlan0
@ryesalvador
ryesalvador / pizilla-pygtk.py
Last active November 17, 2021 02:11
Python + PyGTK + WebKit + Raspberry Pi
# pizilla-pygtk.py
import gtk, webkit
class window(gtk.Window):
def __init__(self):
super(window, self).__init__()
self.set_title("Pizilla-PyGTK")
@ryesalvador
ryesalvador / bochsrc.txt
Created October 9, 2015 04:06
Sample Bochs configuration file
# We give our system 32 Mb of RAM.
megs: 32
# This is the additional package we installed. We add it into our configuration.
display_library: sdl
# This emulates a physical device and loads our bootable IMG file into that device.
floppya: 1_44=Dos5.0.img, status=inserted
# We specify to boot from floppya.
@ryesalvador
ryesalvador / blasteroids_01.py
Created April 1, 2016 13:12
Source code for the "Make a Python 2D game using Pygame Tutorial #1" - https://youtu.be/adiRAQbVz_w
import pygame
SCREEN_WIDTH = 400
SCREEN_HEIGHT = 350
WHITE = (255, 255, 255)
pygame.init()
screen = pygame.display.set_mode([SCREEN_WIDTH, SCREEN_HEIGHT])
pygame.display.set_caption('Hello, World!')
@ryesalvador
ryesalvador / bit_struct.c
Created June 1, 2016 03:13
Using bitfields in storing struct members in C
#include <stdio.h>
/* A field for storing yes or no; uses 1 bit of storage. */
typedef struct {
unsigned int food:1;
unsigned int metal_music:1;
unsigned int dressy_clothes:1;
unsigned int football:1;
} likes;
@ryesalvador
ryesalvador / arrays.php
Created June 1, 2016 09:46
Creating an array in PHP
<?php
/* Adding items in an array implicitly. */
$junk[] = "hamburger";
$junk[] = "snack foods"; //This doesn't get displayed.
$junk[] = "pizza";
$junk[] = "carbonated beverage";
/* Adding items in an array explicitly. */
$junk[6] = "tacos";
@ryesalvador
ryesalvador / tamagotchi.py
Last active January 22, 2024 10:35
Tamagotchi Emulator in PyGame
# Tamagotchi - A port of the Tamagotchi Emulator by aerospark: https://goo.gl/gaZ1fA
# Copyright (C) 2017 Ryan Salvador
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@ryesalvador
ryesalvador / xpong.py
Last active October 24, 2022 06:40
A Python Curses Pong game for your terminal - https://youtu.be/TSmTMt2DM5g
""" XPONG - A Python Curses Pong game for your terminal
Copyright (C) 2020 Ryan Salvador
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of