Skip to content

Instantly share code, notes, and snippets.

View davidthewatson's full-sized avatar

dave davidthewatson

View GitHub Profile
@rain-1
rain-1 / GPT-4 Reverse Turing Test.md
Last active October 8, 2024 02:59
GPT-4 Reverse Turing Test

The reverse turing test

I asked GPT-4 to come up with 10 questions to determine if the answerer was AI or human.

I provided my own answers for these questions and I also asked ChatGPT to answer them.

The result is that GPT-4 was able to correctly differentiate between AI and Human.

@ahoarau
ahoarau / install
Last active August 9, 2021 20:53
ROS Melodic on macOS Catalina
#!/bin/bash
# Software License Agreement (BSD)
#
# Author Mike Purvis <[email protected]>
# Corrected by Fuzzy Logic Robotics, Inc., All rights reserved.
# Copyright (c) 2014-2016, Clearpath Robotics, Inc., All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that
# the following conditions are met:
# * Redistributions of source code must retain the above copyright notice, this list of conditions and the
@lizthegrey
lizthegrey / attributes.rb
Last active September 24, 2024 14:33
Hardening SSH with 2fa
default['sshd']['sshd_config']['AuthenticationMethods'] = 'publickey,keyboard-interactive:pam'
default['sshd']['sshd_config']['ChallengeResponseAuthentication'] = 'yes'
default['sshd']['sshd_config']['PasswordAuthentication'] = 'no'
@davidthewatson
davidthewatson / halloween_lightify.py
Created November 2, 2017 02:11
Flash the house lights like an insane asylum for halloween
from lightify import Lightify
lightify = Lightify('192.168.1.10')
lightify.update_all_light_status()
lights = lightify.lights()
ls = {light.name(): light for light in lights.values()}
def rainbow():
r, g, b = 255, 0, 0
for g in range(256):
yield r, g, b
@anthonygtellez
anthonygtellez / domains.sh
Last active October 14, 2022 09:27 — forked from waako/domains.sh
Lookup A-record and Nameservers for a list of domains in a txt file, output into a csv file
#!/bin/bash
# Put all the domain names in domains.txt, one per line
# then run in the terminal: bash domains.sh
# this will print each domain in the terminal as it looks it up
# The result csv will contains the domain, IP & Nameservers in each column
# Give each column the relevant header titles
echo "Domain Name,IP Address" > dig_cloud-bleed_domains.csv
while read domain
@jeanlouisferey
jeanlouisferey / LXD_SSH_KEY.md
Last active August 26, 2024 23:53
How to create a LXD Container with your ssh key in it (and with ssh server in the container)
@zachwill
zachwill / items.py
Last active September 18, 2023 09:28
An easier way to meld Peewee models and Scrapy items.
import copy
from scrapy import Item
class ModelItem(Item):
"""
Make Peewee models easily turn into Scrapy Items.
>>> from models import Player
>>> item = ModelItem(Player())
"""
@Miserlou
Miserlou / cities.json
Created April 30, 2015 06:58
1000 Largest US Cities By Population With Geographic Coordinates, in JSON
[
{
"city": "New York",
"growth_from_2000_to_2013": "4.8%",
"latitude": 40.7127837,
"longitude": -74.0059413,
"population": "8405837",
"rank": "1",
"state": "New York"
},
@rmax
rmax / myspider.py
Last active April 7, 2021 18:37
An example of a Scrapy spider returning a Twisted deferred.
from scrapy import Spider, Item, Field
from twisted.internet import defer, reactor
class MyItem(Item):
url = Field()
class MySpider(Spider):
@timrichardson
timrichardson / 0_ Gmail API for Service Accounts Python 2.7.
Last active April 28, 2020 19:21
Access gmail via gmail api, Service Account method (applicable if you have Google Apps admin access)
smtp mail sending in cPython blocks the GIL.
This code is tested on python 2.7.8 and I'm using it with web2py
If you use Google Apps for your domain email and if you have admin access, you can easily use the gmail api.
Because you have admin access, you can create a "service account" in the Google Developer Console.
This makes authentication easy.
There are other authorisation methods when you don't have admin access, but they require interaction from the user via a browser.
To use this, you need to install these modules (From PyPI):
pyOpenSSL