Skip to content

Instantly share code, notes, and snippets.

View fastfingertips's full-sized avatar
🧶
knitting..

fastfingertips

🧶
knitting..
View GitHub Profile

In Python, the property() function and decorator play a crucial role in managing attributes by providing a structured way to define getters, setters, and deleters. These tools empower developers to create well-organized and readable code, enhancing the maintainability of their programs.

The Basics of property()

The property() function returns a property attribute, which is particularly useful for defining managed attributes in a class. It takes up to four arguments: fget for the getter function, fset for the setter function, fdel for the deleter function, and doc for creating a docstring.

Here is a basic example:

class C:
import json
test_list = ['2024', '01', '23', '']
keys = list(range(len(test_list)))
keys_2 = list(range(len(test_list) - 1))
# 1
try:
print(json.dumps(
dict(zip(
import asyncio
async def example_coroutine(lock):
print("Before acquiring the lock")
async with lock:
print("Lock acquired")
# Critical section: Access shared resource
print("Inside the critical section")
# Do some work...
print("Lock released")
@fastfingertips
fastfingertips / scraper.js
Created January 8, 2024 05:19
rotten tomatoes guide list scraper
const axios = require('axios');
const cheerio = require('cheerio');
const guide_url = "";
if (guide_url == "") {
console.log("Please set the guide_url variable to the url of the guide you want to scrape.");
return;
}
@fastfingertips
fastfingertips / .yaml
Last active October 19, 2023 05:05
snippets
html
bootstrap
docs
https://getbootstrap.com/docs/5.3/customize/color-modes/#enable-dark-mode
https://getbootstrap.com/docs/5.3/getting-started/download/
python
scraping
https://selenium-python.readthedocs.io/
flask
https://flask.palletsprojects.com/en/2.3.x/patterns/flashing/
@fastfingertips
fastfingertips / video_sharing_sites.md
Last active August 26, 2023 15:07
not require login
javascript:(() => {
function toggleBlurEffect() {
const e = document.body.style.filter;
e && e.includes("blur") ? document.body.style.filter = "" : document.body.style.filter = "blur(30px)";
}
document.addEventListener("click", toggleBlurEffect);
document.title = "Tab name hidden.";
document.querySelectorAll('link[href$=".ico"],link[href*="favicon"]').forEach(e => e.href = "data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=");
})();
interface fastEthernet 0/0
ip address 192.168.1.2 255.255.255.0
no sh
security passwords min-length ?
security passwords min-length 10
line vty 0 4
login local
exec-timeout ?
execc-timeout 2
{
"sessions": {
"12308": {
"start_key": "11072023190618",
"last_key": "11072023190618",
"processes": {
"11072023190618": {
"finished": false
}
}