Skip to content

Instantly share code, notes, and snippets.

View daisycamber's full-sized avatar

Charlotte Harper daisycamber

View GitHub Profile
@daisycamber
daisycamber / Sine Wave Vase.scad
Created July 28, 2019 16:54
This is a vase I made in OpenScad with a sine wave
$fn = 16;
curveModifier = 40;
curveModifier2 = 10;
module uncutVase(width,height,curveModifier,curveModifier2){
for(i=[0:1:height]){
translate([50,50,i]) cylinder(1,sin(i+curveModifier) * curveModifier2+width/2- curveModifier2,sin(i+1+curveModifier)* curveModifier2+width/2-curveModifier2);
}
}
module vase(width,height,wallWidth){
difference(){
@daisycamber
daisycamber / servo-test.ino
Created April 2, 2020 22:20
Arduino servo test
#include <Servo.h>
Servo s1;
Servo s2;
Servo s3;
void setup() {
// put your setup code here, to run once:
s1.attach(9);
s2.attach(10);
@daisycamber
daisycamber / hexapod.py
Created April 5, 2020 23:23
Hexapod code
import serial
import time
ser = serial.Serial('COM12',115200, serial.EIGHTBITS, serial.PARITY_NONE, serial.STOPBITS_ONE) # open serial port
print(ser.name) # check which port was really used
def set_servo(leg,servo,position):
ser.write(serial.to_bytes([0xff,leg*3+servo,position]))#1
LIFT_DELAY = 0.1
@daisycamber
daisycamber / ring.scad
Created April 11, 2020 04:51
This is a ring I created
RESOLUTION = 8;
$fn = RESOLUTION;
SECTIONS_FACTOR = 1;
SECTIONS = 256/SECTIONS_FACTOR;
RADIUS = 1;
RING_RADIUS = 18/2;
BAND_WIDTH = 4;
SEGMENT_LENGTH = ((2 * 3.14159 * RING_RADIUS + RADIUS)/SECTIONS+0.0452)*SECTIONS_FACTOR;//0.27;
HOLE_RADIUS = 0.5;
PATTERN_OFFSET=HOLE_RADIUS;
@daisycamber
daisycamber / sphero.sphero
Created October 1, 2020 18:19
Sphero random movement with collision detection
async function onCollision() {
stopRoll();
setMainLed({ r: 255, g: 0, b: 0 });
await setHeading(getRandomInt(0,359));
await delay(0.5);
setMainLed({ r: 255, g: 22, b: 255 });
setSpeed(100);
}
registerEvent(EventType.onCollision, onCollision);
async function startProgram() {
@daisycamber
daisycamber / compressor.js
Created May 20, 2022 22:41
Compression of strings using using blobs in JavaScript.
var zip = new JSZip();
function en(text, callback){
var thefile = zip.file("file.zip", text);
var reader = new FileReader();
reader.onload=callback // e.target.result
thefile.generateAsync({ type: "blob" }).then(function (content) {
reader.readAsDataURL(content);
});
}
@daisycamber
daisycamber / superres.py
Last active September 4, 2023 07:32
Super resolution with options python
import cv2
from shell.execute import run_command
from django.conf import settings
import numpy as np
import os, sys
from importlib import reload
from cv2 import dnn_superres
from importlib import import_module
from threading import Thread
import traceback
@daisycamber
daisycamber / censor_image.py
Created August 13, 2023 21:15
Censor text in an image with Python
import cv2, pytesseract
import numpy as np
AVERAGE = 100
EXTRA = 1
MIN_TEXT = 4
def censor_image(input_file):
image = cv2.imread(input_file)
transparent_img = np.zeros((image.shape[0], image.shape[1], image.shape[2]), dtype=np.uint8)
data = pytesseract.image_to_data(image, output_type='dict')
@daisycamber
daisycamber / censor_video.py
Last active August 13, 2023 21:18
Censor a video with python
import cv2, pytesseract
import numpy as np
from moviepy.editor import *
FREQUENCY = 200 # The frequency by which the software checks for text and censors it
AVERAGE = 100 # The amount of blur applied to the text
EXTRA = 1 # Space to the sides of the text to be censored, in proportion to the size of the text
MIN_TEXT = 4 # Minumum umber of characters in each place to be censored
def censor_video(input_file, output_file):
@daisycamber
daisycamber / etc_apache2_sites-available_site-le-ssl.conf
Created August 13, 2023 21:21
Apache2 config for secure server with HTTPS and WSS
<IfModule mod_ssl.c>
<VirtualHost *:80>
Redirect permanent / https://mamasheen.com/
</VirtualHost>
<VirtualHost *:443>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this