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 / 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 / kudos-boot.asm
Created April 1, 2020 10:10
Ku-DOS Project bootloader
;KudOS bootdisk (c) Ryan Salvador 04-Jan-2015
bits 16 ;It says we want our code in real mode.
org 0
jmp 07c0h:begin ;The effective address of the start
;of our bootloader.
bootmsg db 'Ku-DOS bootdisk alpha v.1 (c) 2015-2020',10,13,'!Boot successful',10,13,'# ',0
@ryesalvador
ryesalvador / kudos-install.txt
Created April 1, 2020 10:22
KuDOS bootdisk install guide
# Install NASM
$ sudo pacman -S nasm
# Then download source
$ git clone https://gist.github.com/ryesalvador/d274044c06beadb160f0158d0358ab1d kudos
# CD into the source directory
$ cd kudos
# Assemble the code to binary
@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")