Skip to content

Instantly share code, notes, and snippets.

View VeggieVampire's full-sized avatar

Nick Farrow VeggieVampire

  • n-i-c-k.com
  • The edge of space
View GitHub Profile
@VeggieVampire
VeggieVampire / joy.py
Created May 28, 2018 10:48
D-pad example with python3.5 using pygame
import pygame
import sys
pygame.init() # Loads pygame engine
pygame.joystick.init() # main joystick device system
try:
j = pygame.joystick.Joystick(0) # create a joystick instance
j.init() # init instance
print ("Enabled joystick: {0}".format(j.get_name()))
@VeggieVampire
VeggieVampire / game.py
Last active June 13, 2018 07:33
just something I have been playing with in python3. Note add your own images and only setup for a gamepad. Also I only tested on a Pi3 (non windows)
import pygame,sys,glob
pygame.init()
#from pygame import *
try:
j = pygame.joystick.Joystick(0) # create a joystick instance
j.init() # init instance
print ("Enabled joystick: {0} with {1} buttons".format( j.get_name(),j.get_numbuttons()))
import pygame
from pygame.locals import *
from OpenGL.GL import *
from OpenGL.GLU import *
@VeggieVampire
VeggieVampire / Makefile
Last active July 9, 2018 07:54
Basic Perfect Makefile for compiling target .cpp files using g++.
Basic Perfect Makefile for compiling target .cpp files with SDL2 libraries using g++.
#USEAGE: copy Makefile to folder with .cpp files then type "make"
#OBJS specifies which files to compile as part of the project
OBJS = $(wildcard *.cpp)
#CC specifies which compiler we're using
CC = g++
/*
Morse Code Project
This code will loop through a string of characters and convert these to morse code. But first you have to get the password to start the morse code seation.
It will blink two LED lights and play audio on a speaker.
https://www.instructables.com/id/Arduino-Morse-Code/
*/
//**************************************************//
// the setup function runs once when you press reset or power the board
int led6 = 6;
int buzzer = 7;
int val = 0; //value for storing moisture value
int soilPin = A4;//Declare a variable for the soil moisture sensor
int soilPower = 2;//Variable for Soil moisture Power
@VeggieVampire
VeggieVampire / telnet_connectivity_check.exp
Last active August 8, 2019 07:12
This is an expect script that establishes a connection to the IP and port you give it to check connectivity from a remote host.
#!/usr/bin/expect -f
#set multiPrompt {[#>$] }
#exp_internal 1
set NODE [lindex $argv 0];
set IPz [lindex $argv 1];
set Portz [lindex $argv 2];
set Passwdz [lindex $argv 3];
#log_file -noappend output.log
set timeout 1
set force_conservative 0 ;# set to 1 to force conservative mode even if
@VeggieVampire
VeggieVampire / SpotlightController.cs
Created August 18, 2019 08:44
Unity 3D Spotlight Fallow controller. Slow the speed down to have the light fall behind. "Lerp Spotlight "
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SpotlightController : MonoBehaviour {
private Vector3 targetPos;
public float moveSpeed = 10f;
public GameObject followTarget;
public float Xoffset = 0f;
@VeggieVampire
VeggieVampire / FlickeringLightScript.cs
Created August 19, 2019 07:47
Flickering light script in unity 3D.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FlickeringLightScript : MonoBehaviour {
Light testLight;
public float minFlickerTime = 0.1f;
public float maxFlickerTime = 0.04f;
@VeggieVampire
VeggieVampire / RTL-SDR-Signal-Detection.py
Last active December 29, 2022 08:14
This code creates an instance of the RtlSdr class, which represents an RTL-SDR device, and sets the center frequency of the device to 101.1 MHz using the center_freq property. It also sets a step size for the frequency changes in Hz. Next, the code initializes Pygame and creates a window using the pygame.display.set_mode() function. It also sets…
import rtlsdr
import pygame
import time
# Create an instance of the RtlSdr class
sdr = rtlsdr.RtlSdr()
# Set the center frequency of the RTL-SDR device (in Hz)
sdr.center_freq = 101.1e6