Skip to content

Instantly share code, notes, and snippets.

View michabbb's full-sized avatar
💯
Need help ? Call me.....

Micha(el) Bladowski michabbb

💯
Need help ? Call me.....
View GitHub Profile
@michabbb
michabbb / docker-ps-small.sh
Created November 8, 2023 00:13
an example of how to reformat the output of "docker ps" for smaller screens
#!/bin/bash
# Color codes
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Header in green
echo -e "${GREEN}IMAGE\t\t\t\t\t\t\tSTATUS${NC}"
@michabbb
michabbb / PestPHP architecture testing.php
Created April 21, 2024 20:22
PestPHP architecture testing
<?php
/** @see https://twitter.com/garyclarketech/status/1781605977101644015/photo/1 **/
test('debugs are removed')
->expect(['dd', 'dump', 'var_dump'])
->not->toBeUsed();
test('CommandInterface is implemented where is should be')
->expect('App\Command')
@michabbb
michabbb / example.sh
Created October 12, 2023 16:54
ps ax grep without showing your grep ;)
> ps ax|grep sleep
output:
954190 ? Ss 0:00 sleep infinity
1036329 ? S 0:00 sleep 5
1036386 ? S 0:00 sleep 2
1036397 pts/4 S+ 0:00 grep --color=always sleep <---- you don´t want to see this
3610265 ? S 0:00 sleep 1d
3868324 ? S 0:00 sleep 86400
@michabbb
michabbb / livewire_component_with_a_stick_div_on_top.php
Last active September 26, 2023 19:36
laravel livewire component: sticky div on top only displayed at a specific scrollY position handling dehydration and page reload
<div>
@if($searchResult->count()>1)
<div
x-data="{ scrollTop: parseInt(localStorage.getItem('scrollTop')) || window.scrollY }"
x-init="scrollTop = parseInt(localStorage.getItem('scrollTop')) || window.scrollY"
class="bg-skin-fill text-big-button px-5 py-5 fixed top-0 flex flex-row justify-between mx-auto"
x-on:scroll.window="scrollTop = window.scrollY; localStorage.setItem('scrollTop', String(scrollTop))"
x-bind:class="{'hidden': scrollTop <= 600}" x-cloak
>
@michabbb
michabbb / Caddyfile
Last active June 1, 2023 14:17
rewrite /v1/.... to /api/httpsms/v1/.....
{
auto_https off
debug
}
:80 {
root * /app/public
encode zstd gzip
file_server
@michabbb
michabbb / index.js
Last active January 27, 2023 22:08
lambda function to handle eBay Marketplace Account Deletion Notifications
const EventNotificationSDK = require('event-notification-nodejs-sdk');
const https = require('https');
// https://github.com/eBay/event-notification-nodejs-sdk/blob/main/lib/constants.js
const constants = {
ALGORITHM: 'ssl3-sha1',
AUTHORIZATION: 'Authorization',
BASE64: 'base64',
BEARER: 'bearer ',
ENVIRONMENT: {
@michabbb
michabbb / findSellerStandardsProfiles.json
Created June 11, 2020 10:02
ebay findSellerStandardsProfiles response example
{
"standardsProfiles": [
{
"standardsLevel": "ABOVE_STANDARD",
"program": "PROGRAM_US",
"cycle": {
"cycleType": "CURRENT",
"evaluationDate": "2018-07-20T19:30:32.000Z"
},
"evaluationReason": "Default",
@michabbb
michabbb / monitor_website_for_string_and_sent_email_if_not_found.sh
Created July 6, 2017 19:23
Monitor Website for string and send email IF NOT found (without local smtp)
if lynx --dump https://xxxxxxxxxxx |grep --quiet 'Something i am looking for' ; then
echo "Still there"
else
swaks --to xxxxxxxxxx@gmail.com --from "xxxxxxxxx@googlemail.com" --server smtp.gmail.com --auth PLAIN --auth-user "xxxxxxxxxx@googlemail.com" --auth-password "xxxxxxxxxxxxx" -tls -p 587 --h-Subject your-special-subject--body "your body"
fi
@michabbb
michabbb / styles.css
Created August 28, 2022 11:33
neeva.com custom styles for large screens
:root {
--n-column-width-xl: 1200px !important;
--color-semantic-base: #111827 !important;
}
@media (min-width: 3000px) {
.app-layout__pageWidth-3F8hH > div:first-of-type {
width: 2000px !important;
}
.app-layout__maxWidth-21X-0 {
@michabbb
michabbb / run_tinkerwell.sh
Created July 31, 2022 12:30
run tinkerwell (electron) inside docker
docker run --rm --init -it \
--net host --privileged --cap-add SYS_ADMIN \
-v ${HOME}/Tinkerwell-3.5.0.AppImage:/tinkerwell \
-v ${HOME}/PhpstormProjects/:/apps/:rw \
--device /dev/fuse \
-v $SSH_AUTH_SOCK:/ssh-auth.sock \
-e SSH_AUTH_SOCK=/ssh-auth.sock \
-v $HOME/.ssh:/home/docker/.ssh \
-w /home/docker/.config/ \
-v ${HOME}/.tinkerwell:/home/docker/.config:rw \