Skip to content

Instantly share code, notes, and snippets.

View chand1012's full-sized avatar

Chandler chand1012

View GitHub Profile
@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 / 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]) {
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 / 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:
@chand1012
chand1012 / bblayers.conf
Last active May 30, 2019 20:02
Intel x86 Bitbake files
# POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf
# changes incompatibly
POKY_BBLAYERS_CONF_VERSION = "2"
BBPATH = "${TOPDIR}"
BBFILES ?= ""
BBLAYERS ?= " \
/home/user/yoctox86/sources/poky/meta \
/home/user/yoctox86/sources/poky/meta-poky \
@chand1012
chand1012 / bblayers.conf
Created May 30, 2019 12:01
Raspberry Pi Bitbake config files
# POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf
# changes incompatibly
POKY_BBLAYERS_CONF_VERSION = "2"
BBPATH = "${TOPDIR}"
BBFILES ?= ""
BBLAYERS ?= " \
/home/user/rpi/sources/poky/meta \
/home/user/rpi/sources/poky/meta-poky \
desktop:=1
<^<!b::
Run, cmd
return
<^<!t::
run, git-bash.exe
return
@echo off
title youtube-dl script
set /p url="Past url to download:"
youtube-dl %url%
pause
@chand1012
chand1012 / tweepydelete.py
Last active October 15, 2019 19:25
Deletes tweets
import tweepy
def login(key, secret):
auth = tweepy.OAuthHandler(key, secret)
auth_url = auth.get_authorization_url()
verify = input(f"Enter your verification code after authenticating here: {auth_url}\n~$: ")
auth.get_access_token(verify)
return tweepy.API(auth)
@chand1012
chand1012 / AttinyMotor.ino
Last active March 18, 2019 18:53
uses an ATTiny85 to drive a L293D driver
//L293D
//Motor A
#define motorPin1 5 // Pin 14 of L293
#define motorPin2 2 // Pin 10 of L293
//Motor B
#define motorPin3 3 // Pin 7 of L293
#define motorPin4 4 // Pin 2 of L293
//ping sensor
#define echoPin 0