Skip to content

Instantly share code, notes, and snippets.

View chrisdel101's full-sized avatar

Chris Del chrisdel101

  • University of Regina
View GitHub Profile
@chrisdel101
chrisdel101 / timezones.txt
Last active June 16, 2023 17:12
Timezones in psql enum format
('Africa/Abidjan', 'Africa/Accra', 'Africa/Addis_Ababa', 'Africa/Algiers', 'Africa/Asmara', 'Africa/Asmera', 'Africa/Bamako', 'Africa/Bangui', 'Africa/Banjul', 'Africa/Bissau', 'Africa/Blantyre', 'Africa/Brazzaville', 'Africa/Bujumbura', 'Africa/Cairo', 'Africa/Casablanca', 'Africa/Ceuta', 'Africa/Conakry', 'Africa/Dakar', 'Africa/Dar_es_Salaam', 'Africa/Djibouti', 'Africa/Douala', 'Africa/El_Aaiun', 'Africa/Freetown', 'Africa/Gaborone', 'Africa/Harare', 'Africa/Johannesburg', 'Africa/Juba', 'Africa/Kampala', 'Africa/Khartoum', 'Africa/Kigali', 'Africa/Kinshasa', 'Africa/Lagos', 'Africa/Libreville', 'Africa/Lome', 'Africa/Luanda', 'Africa/Lubumbashi', 'Africa/Lusaka', 'Africa/Malabo', 'Africa/Maputo', 'Africa/Maseru', 'Africa/Mbabane', 'Africa/Mogadishu', 'Africa/Monrovia', 'Africa/Nairobi', 'Africa/Ndjamena', 'Africa/Niamey', 'Africa/Nouakchott', 'Africa/Ouagadougou', 'Africa/Porto-Novo', 'Africa/Sao_Tome', 'Africa/Timbuktu', 'Africa/Tripoli', 'Africa/Tunis', 'Africa/Windhoek', 'America/Adak', 'America/Ancho
@chrisdel101
chrisdel101 / put_assoc.ex
Last active May 23, 2023 17:51
Loading put_assoc
# org params
org = %{
"email" => "toys@rus.com",
"name" => "Toys R Us",
"phone" => "777777777",
"slug" => "toys-r-us"
}
# make org changeset
org_changeset = Organization.changeset(%Organization{}, o)
# #Ecto.Changeset<
int rayBoxIntersection(float P0[3], float V[3], float ts[2], int sides, int n)
{
/* Intersect the line with the CT cube to find
two intersection points, t0 and t1, corresponding to the entry and exit points respectively.
Notes: the six sides of the CT cube are defined
in the world coordinates by:
x = 0;
x = 127;
@chrisdel101
chrisdel101 / triLinear.c
Last active March 11, 2023 20:08
Tri linear interpolation
/*----------------TRILINEAR------------------------
*
y 110____11_____111
^ / | / |
| / | A /|
| / | / / |
| 010___|_01______011|
| | | | | |
| | 100_|___10__|_101
@chrisdel101
chrisdel101 / sumSquares.ex
Created February 20, 2023 16:47
Sum sqaures
defmodule SquareSum do
def square_sum([head | tail]) do
(head * head) + square_sum(tail)
end
def square_sum([]) do
0
end
end
#version 300 es
//inputs
in vec3 vPosition;
in vec3 vNormal;
//outputs
out vec4 color;
//lighting structures
@chrisdel101
chrisdel101 / shrink.md
Last active September 15, 2022 17:34
Shrink to viewport

I am looking to replicate the puppeteer fullPage feature. This shrinks an element into the page viewport before taking a screenshot. This is what I want: My element to be forced to fit into the viewport. I looked at the fullPage source code but couldn't tell what it was doing exactly. Maybe it's using JS and not CSS? I don't expect anyone will know this.

I tried applying every variation of height restrictions to body and then adding max-height,height or min-height to the div, but it doesn't obey height with any of these. I've tried adding height restrictions to all the children but even then nothing happens.

Here is what happpens with puppeteer when I set the viewport to 600x600. It returns an element (screenshot to be exact) which is 300x536. Before taking the shot, the whole card is compressed down and is viewable. This what I want in the browser in html:

[![ente

@chrisdel101
chrisdel101 / buildSphere.js
Created September 9, 2022 17:06
Shphere in webgl
// based on text book 2.4 https://inspirit.net.in/books/academic/Interactive%20Computer%20Graphics.pdf
function buildSpherePoints(){
const DegreesToRadians = Math.PI / 180.0; // Math.PI = 3.14159...
let quad_data = []; // 8 rows of 18 quads
let k = 0;
for(let phi = -80.0; phi <= 80.0; phi += 20.0)
{
let phir = phi*DegreesToRadians;
let phir20 = (phi + 20.0)*DegreesToRadians;
for(let theta = -180.0; theta <= 180.0; theta += 20.0)
@chrisdel101
chrisdel101 / gist:882ed4c9aaa7fe5a1a881d5de1f3133c
Last active August 8, 2022 16:13
Not pass in None kwargs to override default
def tester(paramA="Default Value"):
if paramA is None:
print('True')
else:
print('False')
def foo(**kwargs):
tester(kwargs.get('paramA'))
foo(paramA=None) ## True
@chrisdel101
chrisdel101 / Dyno-ex1.bash
Last active July 20, 2022 15:14
Example of the fake serial message exchange; 2 examples of trying to write and read to it, and the resuls
# It hangs, or else I thik this would be almost correct
Python 3.7.3 (default, Jan 22 2021, 20:04:44)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from Dyno.Classes.Dyno.Dyno import Dyno
ENV development
>>> dyno = Dyno()
Listening on ('localhost', 65432)
>>> dyno.makeSerialConnection()