Skip to content

Instantly share code, notes, and snippets.

View pvcraven's full-sized avatar

Paul V Craven pvcraven

View GitHub Profile
@pvcraven
pvcraven / sendRawEth.c
Created September 21, 2016 16:01 — forked from austinmarton/sendRawEth.c
Send a raw Ethernet frame in Linux
/*
* 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>
@pvcraven
pvcraven / lint_example.py
Last active June 21, 2017 18:35
What is the proper way to do this code, so a linter does not see an error?
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.
"""
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from typing import TypeVar
import time
import collections
import math
import random
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from typing import TypeVar
import time
import collections
import math
import random
from PIL import Image
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from typing import TypeVar
import time
import collections
import math
import random
from PIL import Image
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)]
@pvcraven
pvcraven / gist:fd8a7492e4e67f9c75dfeb66954acaca
Last active March 28, 2020 18:45
Modern GL and frame buffer work
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
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
"""
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
"""
"""
"""
import arcade
WIDTH = 800
HEIGHT = 600