Skip to content

Instantly share code, notes, and snippets.

@ORESoftware
ORESoftware / resize-base64.js
Last active May 15, 2024 18:20
resizing an image on the front-end before sending to a server
// Using this code, we can retrieve an image from a user's filesystem, resize the image, and then upload the image
// to a server using AJAX. Because we use base64 encoding, we can just include the image data as just another string value
// in a JSON payload.
// So we can use AJAX to send the file to a server, which is convenient.
// We have one line of relevant html
// get file in the first place => <input type="file" custom-on-change="onAcqImageFileChange" class="form-control">
#!/usr/bin/env python3
'''
always getting the most recent frame of a camera
================================================
Usage:
------
freshest_camera_frame.py
@wojteklu
wojteklu / clean_code.md
Last active May 15, 2024 18:20
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@IT-Berater
IT-Berater / clean_code.md
Last active May 15, 2024 18:19 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.

Clean-code


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
@soatok
soatok / matrix.md
Last active May 15, 2024 18:19
Why I Don't Trust Matrix Developers to Produce a Secure Protocol

Ever since I wrote It's Time For Furries to Stop Using Telegram, I've had a few folks ask me about my opinion on Matrix.

(I've also had a few people evangelize Matrix in my mentions. That's annoying.)

My stance on Matrix has been the same for years: I don't trust the Matrix developers to produce a secure protocol, and until they abandon Olm / Megolm in favor of something like MLS, I'm adamant about refusing to trust their team's designs.

To understand why I feel so strongly about this, you need to understand that practically exploitable vulnerabilities were found in Matrix in 2022.

It isn't enough that there were vulnerabilities found to be alarming. Vulnerabilities happen. You aren't writing software if you don't occasionally fuck up.

@SamL98
SamL98 / get_recents.py
Last active May 15, 2024 18:18
Python Script for Getting Spotify Listening History
# To run as a local cron job, edit your crontab like so:
#
# SPOTIPY_USER_ID=<redacted>
# SPOTIPY_CLIENT_ID=<redacted>
# SPOTIPY_CLIENT_SECRET=<redacted>
# script_path=<redacted>
# SPPATH=$script_path
# python_path=/Library/Frameworks/Python.framework/Versions/3.6/bin/python3
#
# PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin
# Luke's config for the Zoomer Shell
# Enable colors and change prompt:
autoload -U colors && colors
PS1="%B%{$fg[red]%}[%{$fg[yellow]%}%n%{$fg[green]%}@%{$fg[blue]%}%M %{$fg[magenta]%}%~%{$fg[red]%}]%{$reset_color%}$%b "
# History in cache directory:
HISTSIZE=10000
SAVEHIST=10000
HISTFILE=~/.cache/zsh/history
@perkinslr
perkinslr / regexfind.py
Created July 24, 2018 02:17
Regex Specificity Matcher
import re
def _exapnd_regex(a, p, out_strings):
one = False
last = 0
d = p.finditer(a)
for e in d:
one = True
grp = e.group()
@crock
crock / RangeSlider.js
Last active May 15, 2024 18:14
Multi-handle range slider input (HTML5 Web Component)
import { polyfillDeclarativeShadowDom } from "./pollyfill";
/**
* Multi-handle range slider input Web Component
* @class RangeSlider
* @extends HTMLElement
* @property {number} min - Minimum value of the slider
* @property {number} max - Maximum value of the slider
* @property {number} step - Step value of the slider
* @property {number[]} values - Array of values for each handle
@abul4fia
abul4fia / ligth_theme.py
Last active May 15, 2024 18:13
Light theme for manim
# Put this file in the same folder than your manim script
# and start your script with:
#
# import light_theme
from manim import *
config.background_color = WHITE
# Those are objects which are WHITE by default