Skip to content

Instantly share code, notes, and snippets.

View chand1012's full-sized avatar

Chandler chand1012

View GitHub Profile
@chand1012
chand1012 / comparetextfile.py
Created June 27, 2019 15:34
Compares two files and puts their common lines in a file called output.txt
import sys
def common_item(lista, listb, mode=0):
items = []
for x in lista:
for y in listb:
if x==y:
if not mode:
return True
if mode:
import math
def f(x): # change this to the function of your choice
squared = math.pow(x, 2)
return math.sqrt(squared+1)
a = 0 # start
b = 2 # end
n = 6 # increase for more accuracy
dx = (b-a)/n
@chand1012
chand1012 / singleBrick.scad
Last active January 6, 2020 17:34
Just a single studded lego brick in openscad
$fn = 50;
union () {
difference() {
cube([8, 8, 9.6], center=true);
translate([0, 0, -3.2]) {
cube([4.8, 4.8, 3.2*3], center=true);
}
}
translate([0,0,9.6/2]) {
@chand1012
chand1012 / random_name.py
Created January 9, 2020 18:34
Gets a random name from https://uinames.com/ via Python Requests
import requests
# https://uinames.com/
def random_name(amount=1, gender="", region="", minlen="", maxlen="", key="name"):
if gender != "":
gender = "?gender=" + gender
if region != "":
@chand1012
chand1012 / MyPrusaSlicerSettings.ini
Created January 30, 2020 20:16
My settings for my Ender 3 on PrusaSlicer
# generated by PrusaSlicer 2.1.1+win64 on 2020-01-30 at 20:15:18 UTC
[print:0.2 mm]
avoid_crossing_perimeters = 0
bottom_fill_pattern = rectilinear
bottom_solid_layers = 3
bridge_acceleration = 0
bridge_angle = 0
bridge_flow_ratio = 1
bridge_speed = 60
@chand1012
chand1012 / equal.cpp
Created April 22, 2020 16:07
Random recursive equal function
bool equal(int x, int y)
{
if (x == 0 && y == 0)
{
return true;
}
x--;
y--;
if (x<0 || y<0)
{
@chand1012
chand1012 / weather.py
Last active July 2, 2020 15:15
US government weather api response time test
import requests
class USGovWeatherSearch():
def __init__(self):
self.lat = 41.08
self.lng = -81.51
self.gridx = 0
self.gridy = 0
self.base_url = "https://api.weather.gov/"
self.json = None
@chand1012
chand1012 / blinds.py
Created July 11, 2020 20:11
Scheduling System from Ian's Blinds project.
from json import loads
from datetime import datetime
from time import sleep
def operate_blinds(opened=False):
# operate the blinds
# write your blind operation code here
print(f"Blinds state: {opened}")
if __name__=="__main__":
@chand1012
chand1012 / lackExtender.scad
Created July 20, 2020 01:23
This is my lack table extender.
// in mm
height = 180;
leg_width = 55.88;// this is the length of width of the table leg
union() {
translate([0, 0, height*0.6]) {
difference() {
cube([leg_width, leg_width, 38.1], center=true);
cube([leg_width-6.35, leg_width-6.35, 38.25], center=true);
@chand1012
chand1012 / home_dir_example
Created August 10, 2020 19:52
Example of listing your home directory
Desktop
Documents
Downloads
Music
Pictures
Public
Templates
Videos