Skip to content

Instantly share code, notes, and snippets.

View MarcScott's full-sized avatar

Marc Scott MarcScott

View GitHub Profile
from pyowm import OWM
from time import time
KEY = 'Your Key'
owm = OWM(KEY)
mgr = owm.weather_manager()
observation = mgr.forecast_at_place('London,GB', '3h')
weathers = observation.forecast.weathers
@MarcScott
MarcScott / csgo.sh
Last active February 28, 2021 20:41
CSGO server script
#!/bin/sh
echo
echo Brownsoft Incorporated - CSGO Auto launcher
echo -------------------------------------------
echo
key=`cat /home/mjs/key.txt`
gamemode=""
gametype=""
echo "Step 1 - select your game type. Default is 'Classic casual'."
@MarcScott
MarcScott / audio_detect.py
Created October 14, 2020 10:29
Detect claps via mic
import pyaudio
import numpy as np
from time import sleep
CHUNK = 2**11
RATE = 44100
audio=pyaudio.PyAudio()
stream=audio.open(format=pyaudio.paInt16,channels=1,rate=RATE,input=True,
frames_per_buffer=CHUNK)
angle=0
function setup() {
createCanvas(600, 600, WEBGL);
}
function draw() {
background(0);
push();
rotateX(angle)
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
];
# Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true;
@MarcScott
MarcScott / gist:09ae64166689ebaab5d605a1cd1c237a
Created November 23, 2017 12:58
Simple Game of Life for learners
from guizero import App, Waffle
from time import sleep
from random import randint
app = App()
gun = """........................................................
.........................*..............................
.......................*.*..............................
.............**......**............**...................
import os
from glob import glob
import re
from pprint import pprint
import itertools
PROJECT = "santa-detector"
PROJECT_DIR = "/home/mjs/WIP/copy/"
preamble_ingredient="""Could I get a copy edit on this resource please?
## Functions for each gate.
def NAND(A, B):
if A == False:
return True
elif B == False:
return True
else:
return False
Edits for Diagrams
1. The diagram on [this page](https://www.futurelearn.com/courses/physical-computing-raspberry-pi-python/1/steps/161874) needs changing. Your house circuit uses AC, so the diagram is factually inaccurate. I thin the internals of a torch would be better. Perhaps show 2 batteries and a switch connected to the lamp.
![image](https://media1.britannica.com/eb-media/49/160449-049-B0977C93.jpg)
1. The diagram and animations on https://www.futurelearn.com/courses/physical-computing-raspberry-pi-python/1/steps/161840#fl-comments show a single battery. This should really be 2 batteries in series (the +ve of the first connected to the -ve of the second). This will provide 3V which is enough to light an LED.
1. Can they also be edited so that the wires connect to the little bump on the +ve end of the battery
import requests
import string
import re
from collections import Counter
cnt = Counter()
pp = requests.get('http://www.gutenberg.org/files/1342/1342-0.txt').text
ss = requests.get('http://www.gutenberg.org/cache/epub/161/pg161.txt').text
def only_letters(book):