Skip to content

Instantly share code, notes, and snippets.

View creeper6530's full-sized avatar
💭
I may be slow to respond (because school sucks).

creeper6530

💭
I may be slow to respond (because school sucks).
  • Czechia
  • 06:03 (UTC +02:00)
View GitHub Profile
@creeper6530
creeper6530 / dht20_v2.py
Last active December 10, 2023 17:35
Python code for reading DHT20 sensor from Raspberry Pi (improved)
#!/usr/bin/python3
# Import stuff
import smbus
from time import sleep
from os import remove
class Lock:
# Constructor - define class-wide variables
@creeper6530
creeper6530 / dht20.py
Created May 21, 2023 18:08
Python script to measure temperature and humidity using the Seeed Grove DHT20 sensor
#!/usr/bin/python3
import smbus
import time
import argparse
try:
bus = smbus.SMBus(1)
except PermissionError:
print("Could not open I2C bus: Permission denied.")
print("Try re-running the script as root.")
@creeper6530
creeper6530 / README.md
Last active May 4, 2023 17:13
DuckDuckGo search in Linux terminal

Installation

  1. Save the script, for example, as ddg
  2. Run sudo chmod a+x ddg
  3. Move the script into your PATH folder
  4. Enjoy!

Dependencies

  • Bash
  • Python 3 (should be preinstalled on most distros)
  • Lynx (isn't usually preinstalled, install it with sudo apt install lynx or the corresponding packet manager for your distro