Here are some tools, techniques, ideas and anything else that might be useful in everyday life.
Tools
ray.so
Do you ever find yourself needing to include code examples in documentation or presentations? Now, you can streamline that process by using this tool to generate images of your code snippets. No more wasting time formatting and adjusting code manually. With this tool, you can quickly and easily create images of your snippets, adding a professional touch to your documentation and presentations.
sli.dev
Nothing beats crafting presentations as code! Slidev, powered by Vite and Vue, allows customization, creation of reusable components, and layouts.
CyberChef
This website is a collection of utilities for information security. Here's how it works: you assemble a pipeline, adding functions like encoding and hashing, then provide an input, and it generates an output based on the pipeline.
Mermaid Live
Have you ever needed to generate a workflow using tools like draw.io? Wouldn't it be great to have that as code? Well, now you can have it all: editable, shareable, and codable.
Typer
If you need to build a command-line tool and know Python, this little guy here is going to be a huge help.
Cheat.sh
Command-line heat-sheet that has more than 50 languages.
The coolest thing is that it works directly in the terminal via curl
.
Command
curl cht.sh/python/lambda
Output
# Lambda are anonymous functions in Python by using the keyword lambda
# Therefore they are not bound to a name
# Simple Lambda Function
a = lambda parameter: parameter + 40
#
print (a(2)) # Outputs 42
# Lambda Functions Inside Real Functions
def subtract_func(n) :
return lambda x: x - n
#
a = subtract_func(1) # Sets n to 1 for a
b = subtract_func(2) # Sets n to 2 for b
#
print(a(-4)) # Outputs -5 ( -5 = -4 - 1 )
print(b(-2)) # Outputs -4 ( -4 = -2 - 2 )
# Lambda Function with Multiple Parameters
f = lambda x, y : x + y
#
print( f(1,1) ) # Outputs 2 ( 1 + 1 )
# map() + lambda functions
a = [1, 2, 3, 4, 5]
b = [1, 2, 3, 4, 5]
#
r = map(lambda x,y : x+y, a,b) # map() will return an iterator
r_list = list(r) # listify r
print(r_list) # prints [2, 4, 6, 8, 10]
# filter() + lambda functions
# Program to filter out only the even items from a list
my_list = [1, 5, 4, 6, 8, 11, 3, 12]
#
new_list = list(filter(lambda x: (x%2 == 0) , my_list))
#
print(new_list) # Output: [4, 6, 8, 12]
Top comments (0)