Skip to content

Instantly share code, notes, and snippets.

View calthoff's full-sized avatar

Cory Althoff calthoff

View GitHub Profile
from PIL import Image
import numpy as np
im = Image.open('cold_cat.png')
im = im.convert('RGBA')
data = np.array(im) # "data" is a height x width x 4 numpy array
red, green, blue, alpha = data.T # Temporarily unpack the bands for readability
# Replace white with red... (leaves alpha values alone...)
import express from 'express';
import { initializeApp } from 'firebase/app';
import { getDatabase, ref, set, onValue } from "firebase/database";
import 'dotenv/config'
import { dirname } from 'path';
import { fileURLToPath } from 'url';
import { createRequire } from 'module'
const require = createRequire(import.meta.url)
const Vonage = require('@vonage/server-sdk')
var bodyParser = require('body-parser')
import random
a_list = []
for i in range(0, 20):
j = random.randint(1, 30)
a_list.append(j)
print(j, end= " ")
x = 1
n = 5
a_list = []
for i in range(1, n + 1):
a_list.append(x)
x = x * i
x = 1
n = 5
for i in range(1, n + 1):
x = x * i
<!DOCTYPE html>
<html>
<head>
<style>
#v1, #c1, #c2 { display: none }
</style>
</head>
<body>
<video id="v1" width="320" height="240" autoplay></video>
<canvas id="c1" width="320" height="240"></canvas>
class Node:
def __init__(self, data, next=None):
self.data = data
self.next = next
class Queue:
def __init__(self):
self.front = None
self.rear = None
import heapq
def dijkstra(graph, starting_vertex):
distances = {vertex: float('infinity') for vertex in graph}
distances[starting_vertex] = 0
pq = [(0, starting_vertex)]
while len(pq) > 0:
current_distance, current_vertex = heapq.heappop(pq)
#exercise 1
print("It was a bright cold day in April, and the clocks were striking thirteen."[:33])
#exercise 2
print(""" "Hi" """)
#exercise 3
print('A screaming comes across the sky.'.replace('s', '$'))
#exercise 4
# exercise 1
for c in "Camus":
print(c)
# exercise 2
print("aldous was born in 1894.".capitalize())
# exercise 3
print("Where now? Who now? When now?".split('?'))