Skip to content

Instantly share code, notes, and snippets.

View TheNorthEestern's full-sized avatar

Kacy James TheNorthEestern

View GitHub Profile
import requests
from pprint import pprint
import xml.etree.ElementTree as ET
session = requests.Session()
session.headers.update({'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:77.0) Gecko/20100101 Firefox/77.0'})
r = session.get("https://www.reddit.com/r/NHKEasyNews/.rss")
root = ET.fromstring(r.text)
@TheNorthEestern
TheNorthEestern / graphic2.py
Created May 28, 2020 02:47 — forked from zmic/graphic2.py
Snippet 2 : meltdown in the complex plane
import os
import numpy as np
from PIL import Image
#-------------------------------------------------------------------
#
# helper functions
#
def create_complex_plane(X, Y, x0, x1, y0, y1, endpoint=False):
I = np.indices((Y,X)).astype(np.float64)
@TheNorthEestern
TheNorthEestern / AutoCorrection.swift
Created May 30, 2019 20:51 — forked from shaulhameed/AutoCorrection.swift
Auto correction implementation for swift based on http://norvig.com/spell-correct.html. Improved the search performance using "trie" data structure.
//
// Trie.swift
// AutoCorrect
//
// Created by Shaul Hameed on 30/07/17.
//
//
func exposeAtPoint(point: CGPoint) {
let device = activeInput.device // var activeInput: AVCaptureDeviceInput!
if device.isExposurePointOfInterestSupported && device.isExposureModeSupported(.continuousAutoExposure) {
do {
try device.lockForConfiguration()
device.exposurePointOfInterest = point
device.exposureMode = .continuousAutoExposure
if device.isExposureModeSupported(.locked) {
device.addObserver(self, forKeyPath: "adjustingExposure", options: .new, context: &adjustingExposureContext)
class ViewController: UIViewController, ARSCNViewDelegate {
// Rest of class code goes above here ...
func session(_ session: ARSession, cameraDidChangeTrackingState camera: ARCamera) {
var status = "Loading..."
switch camera.trackingState {
case .notAvailable:
status = "Not available"
case .limited(_):
class ViewController: UIViewController, ARSCNViewDelegate {
// Rest of class code goes above here ...
func session(_ session: ARSession, cameraDidChangeTrackingState camera: ARCamera) {
var status = "Loading..."
switch camera.trackingState {
case .notAvailable:
status = "Not available"
case .limited(_):
extension SCNAction {
static func oscillation(amplitude a: CGFloat, timePeriod t: Double) -> SCNAction {
let action = SCNAction.customAction(duration: t) { node, currentTime in
let displacement = a * sin(2 * .pi * currentTime / CGFloat(t))
node.position.x = Float(displacement)
}
return action
}
}
function love.load()
love.mouse.setVisible(false)
board = {
width = 13,
height = 6
}
-- Each subarray of stops defines the beginning and end color
-- of a row.
// UniForm PEG
// @autos #miles 3000
start =
expression
expression = cat:category* prop:property* {return JSON.stringify({"category": cat, properties:prop}, undefined, 2); }
category = whitespace '@'symbol:word whitespace { return symbol; }
property = whitespace
@TheNorthEestern
TheNorthEestern / move.lua
Created October 20, 2013 22:11
movement code
function love.update(dt)
if love.keyboard.isDown('d') then
x = x + 100 * dt
end
if love.keyboard.isDown('a') then
x = x - 100 * dt
end
if love.keyboard.isDown('w') then
y = y - 1 * dt
end