Skip to content

Instantly share code, notes, and snippets.

Avatar

Paul V Craven pvcraven

View GitHub Profile
View gist:a8d503ad4711bb77c685d7ccd33d0ae9
"""
Sprite Collect Coins
Simple program to show basic sprite usage.
Artwork from http://kenney.nl
If Python and Arcade are installed, this example can be run from the command line with:
python -m arcade.examples.sprite_collect_coins
"""
View gist:25f45b504df43f3fa255c8c4fce78caf
import random
import arcade
import os
import pyglet
import pyglet.gl as gl
# --- Constants ---
SPRITE_SCALING_PLAYER = 0.5
SPRITE_SCALING_COIN = .25
COIN_COUNT = 50
@pvcraven
pvcraven / gist:fd8a7492e4e67f9c75dfeb66954acaca
Last active Mar 28, 2020
Modern GL and frame buffer work
View gist:fd8a7492e4e67f9c75dfeb66954acaca
import numpy as np
import moderngl
from moderngl_window import geometry
from ported._example import Example
from pathlib import Path
import os
class SimpleColorTriangle(Example):
gl_version = (3, 3)
aspect_ratio = 16 / 9
View Data assignment timing
import numpy
import time
import ctypes
LIST_SIZE = 100_000
CYCLE_COUNT = 100
def test_native():
my_list = [0 for i in range(LIST_SIZE)]
View gist:b1e52f77018350cb1695b07efd1306dd
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from typing import TypeVar
import time
import collections
import math
import random
from PIL import Image
View gist:8a07df72a36f767ba94af3356efc92fe
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from typing import TypeVar
import time
import collections
import math
import random
from PIL import Image
View gist:9ac11c26f1a45c175ea6816413c05898
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from typing import TypeVar
import time
import collections
import math
import random
@pvcraven
pvcraven / lint_example.py
Last active Jun 21, 2017
What is the proper way to do this code, so a linter does not see an error?
View lint_example.py
from typing import Iterable
from typing import TypeVar
from typing import Generic
"""
This is the API section.
The user should not be changing this part of the code.
"""
@pvcraven
pvcraven / sendRawEth.c
Created Sep 21, 2016 — forked from austinmarton/sendRawEth.c
Send a raw Ethernet frame in Linux
View sendRawEth.c
/*
* 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.
*/
#include <arpa/inet.h>
#include <linux/if_packet.h>
#include <stdio.h>