Skip to content

Instantly share code, notes, and snippets.

View doismellburning's full-sized avatar
🔥

Kristian Glass doismellburning

🔥
View GitHub Profile
@doismellburning
doismellburning / gist:a306826cb4c9ac9de56130f6fd535d75
Created January 14, 2021 22:40
bed-light-button-kristian.yaml
light:
- platform: fastled_clockless
chipset: SK6812
name: "LED"
pin: GPIO27
id: led
num_leds: 1
binary_sensor:
- platform: gpio
# Quick example Django view to send authenticated users to a "home" page and show a landing page to others
def index(request):
if request.user.is_authenticated:
return redirect(reverse("home"))
return render(request, "oldschool/landing.html")
diff --git a/constraints.txt b/constraints.txt
index 706f7da..5cbbff4 100644
--- a/constraints.txt
+++ b/constraints.txt
@@ -121,6 +121,22 @@ zodbpickle==2.0.0
coverage==5.0.4
nose==1.3.7
+# Linting tools
+configparser==4.0.2
@doismellburning
doismellburning / 99-hardcoded-dns-entries.conf
Created April 1, 2020 10:16
Pi-hole static DNS entries
# Ubuqiti unifi/USG doesn't seem to let me just add DNS entries for fixed-IP DHCP hosts so let's do it here:
address=/pihole.example.com/10.13.37.1
// Package asyncdns is a terrible, inflexible, async reverse-DNS lookup tool
package asyncdns
import "fmt"
import "net"
type Wibble struct {
host string // IP address in theory
hostname string
err error
Aug 22 23:17:01 raspberrypi CRON[1691]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Aug 22 23:18:20 raspberrypi kernel: [ 234.817732] Unable to handle kernel NULL pointer dereference at virtual address 00000000
Aug 22 23:18:20 raspberrypi kernel: [ 234.821421] pgd = 71fd56dd
Aug 22 23:18:20 raspberrypi kernel: [ 234.823252] [00000000] *pgd=00000000
Aug 22 23:18:20 raspberrypi kernel: [ 234.825073] Internal error: Oops: 17 [#1] ARM
Aug 22 23:18:20 raspberrypi kernel: [ 234.826854] Modules linked in: bnep hci_uart btbcm serdev bluetooth ecdh_generic 8021q garp stp llc brcmfmac brcmutil sha256_generic cfg80211 rfkill raspberrypi_hwmon snd_bcm2835(C) hwmon snd_pcm snd_timer bcm2835_codec(C) snd v4l2_mem2mem bcm2835_v4l2(C) bcm2835_mmal_vchiq(C) v4l2_common videobuf2_dma_contig videobuf2_vmalloc videobuf2_memops videobuf2_v4l2 videobuf2_common videodev media vc_sm_cma(C) uio_pdrv_genirq fixed uio ip_tables x_tables ipv6
Aug 22 23:18:20 raspberrypi kernel: [ 234.838816] CPU: 0 PID: 21 Com
/*
* The version info. Please use this info when reporting bugs.
* It is displayed in the game by typing 'version' while editing.
* Do not remove these from the code - by request of Jason Dinkel
*/
#define VERSION "ILAB Online Creation [Beta 1.0, ROM 2.3 modified]\n\r Port a ROM 2.4 v1.00\n\r"
#define AUTHOR " By Jason([email protected])\n\r Modified for use with ROM 2.3\n\r By Hans Birkeland ([email protected])\n\r Modificado para uso en ROM 2.4b4a\n\r Por Birdie ([email protected])\n\r"
#define DATE " (Apr. 7, 1995 - ROM mod, Apr 16, 1995)\n\r (Port a ROM 2.4 - Nov 2, 1996)\n\r Version actual : 1.5a - Mar 9, 1997\n\r"
#define CREDITS " Original by Surreality([email protected]) and Locke([email protected])"

I know installing packages from both apt and pip can be ick but any tips on troubleshooting this please:

[2018-04-03T18:59:54+0000 pi@raspberrypi ~] $ sudo apt-get install python3-pyqt5
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3-pyqt5 is already the newest version (5.7+dfsg-5).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
@doismellburning
doismellburning / out.txt
Last active January 4, 2017 16:36
Django TestClient sessions - what am I missing...?
======================================================================
FAIL: test_clear_token_with_token (article.tests.test_views.ArticleViewsTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/root/article/tests/test_views.py", line 92, in test_clear_token_with_token
self.assertIsNotNone(self.client.session.get('token'))
AssertionError: unexpectedly None
----------------------------------------------------------------------
@doismellburning
doismellburning / settings.py
Created December 20, 2016 13:51
Running Django on EC2? Use this if you need your instance's IP in `ALLOWED_HOSTS`
try: # pragma: no cover
# From http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html
_local_ip = requests.get(
'http://169.254.169.254/latest/meta-data/local-ipv4',
timeout=0.1,
).text
ALLOWED_HOSTS.append(_local_ip)
except requests.exceptions.RequestException:
pass