Skip to content

Instantly share code, notes, and snippets.

View roman4ello's full-sized avatar

Roman roman4ello

  • Ukraine
View GitHub Profile
@roman4ello
roman4ello / gist:52658e2252b279942ade40e970cd6a05
Created June 7, 2024 11:42
Jakarta controller annotations to Spring annotations
| Jakarta RESTful Web Services | Spring REST | What it does |
|------------------------------|------------------------------|-------------------------------------------------------------------|
| @PathParam | @PathVariable | Binds the method parameter to a path segment. |
| @QueryParam | @RequestParam | Binds the method parameter to the value of an HTTP query parameter.|
| @MatrixParam | @MatrixVariable | Binds the method parameter to the value of an HTTP matrix parameter.|
| @HeaderParam | @RequestHeader | Binds the method parameter to an HTTP header value. |
| @CookieParam | @CookieValue | Binds the method parameter to a cookie value. |
| @FormParam | @RequestParam | Binds the method parameter to a f
@roman4ello
roman4ello / gist:4ba42a2a8bb160f2ca9ca74cacb2beea
Last active October 2, 2023 10:49
Create user in Dockerfile
FROM amazoncorretto:8u382-alpine-jre
ARG USER_ID=YOUR_USER_ID
ARG GROUP_ID=YOUR_GROUP_ID
ARG USER_NAME=YOUR_USER
ARG GROUP_NAME=YOUR_GROUP
RUN set -x && addgroup -g $GROUP_ID $GROUP_NAME && \
adduser --shell /sbin/nologin \
--disabled-password \
@roman4ello
roman4ello / GCP cloud run delete all non active revisions
Created April 13, 2023 11:33
GCP cloud run delete all non active revisions
REVS=`gcloud run revisions list --filter="status.conditions.type:Active AND status.conditions.status:'False'" --format='value(metadata.name)'`
for rev in `echo $REVS`; do
echo $rev
gcloud run revisions delete $rev --quiet &
done
* Install ffmpeg
apt-get install -yqq ffmpeg
* Exmaple command to start video record capturing of the screen on ubuntu:
[ffmpeg -y -loglevel debug -s 1920x1080 -framerate 15 -f x11grab -i :0.0 -b 5000k -vcodec mpeg4]
Where:
-y -- Overwrite output files without asking.
-loglevel debug -- actually logging level
-s 1920x1080 -- screen size
@roman4ello
roman4ello / Fix for: ['dict' object has no attribute]
Last active January 17, 2022 10:13
AttributeError: 'dict' object has no attribute ... error .... using Selenium and ChromeDriver
Latest changes on selenium and chromedriver may result in errors like:
[AttributeError: 'dict' object has no attribute ... error .... using Selenium and ChromeDriver]
To fix this:
1. Implement a step to check if this dict in the result.
2. Create WebElement from the value of the dictionary.
Here is an example of the code:
def get_web_element_from_dict_if_it_is(driver: WebDriver, element_to_check_for_dict):
@roman4ello
roman4ello / create_GCP_instance.txt
Last active June 1, 2021 11:47
Create instance in GCP(Как создать инстанс в GCP)
ENG:
1. Login to https://console.cloud.google.com/compute/instances?
2. Check that you are on "Compute engine" page
3. Select "VM instances"
4. Click on "create instance" button
5. Indicate the name, indicate the labels (if necessary), indicate the region and zone of the region.
6. Select the type of machine configuration - N1 ---> g1-small to make it more economical(like the cheapest)
7. In the "Boot disk", select the OS image.
8. In "Service account" -> select your service account
9. In "Security" -> add your ssh-key