Skip to content

Instantly share code, notes, and snippets.

View fearless-spider's full-sized avatar
🏠
Working from home

Przemysław Pająk fearless-spider

🏠
Working from home
View GitHub Profile
@fearless-spider
fearless-spider / docker_access_denied_443_80.txt
Created February 22, 2024 15:37
fix 0.0.0.0:80 and 0.0.0.0:443 access denied with docker
sudo sysctl net.ipv4.ip_unprivileged_port_start=443
sudo sysctl net.ipv4.ip_unprivileged_port_start=80
DISCOUNTS_BY_QUANTITY = {
8 => 275.00,
4 => 150.00,
}
if Input.cart.line_items.length == 4 || Input.cart.line_items.length == 8
discount = Input.cart.subtotal_price - (Money.new(cents: 100) * DISCOUNTS_BY_QUANTITY[Input.cart.line_items.length])
Input.cart.line_items.each do |line_item|
next line_item.properties.has_key?("_bundle")
new_line_price = 0
discount_after_item_disc = discount - line_item.variant.price

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

You must use a system's de service unit. Locate it in /etc/systemd/system.
Example:
/etc/systemd/system/ana-server.service
[Unit]
Description=Servidor TCP/IP-Serie para la comunicacion con los sensores del Arduino
After=syslog.target network.target
[Service]
ExecStart=/usr/share/analog/analogArduinoServer.py
Restart=on-abort
@fearless-spider
fearless-spider / gist:cc2f12b0f7eebd79eebc3adbf938bc0b
Last active January 4, 2022 19:25
Select mirrors for R packages
## Default repo
local({r <- getOption("repos")
r["CRAN"] <- "http://cran.r-project.org"
options(repos=r)
})
or
chooseCRANmirror(81)
@fearless-spider
fearless-spider / index.html
Created August 8, 2021 21:30 — forked from imgerson/index.html
Interactive video with HTML5 and JavaScript
<!DOCTYPE html>
<html>
<head>
<title>Basic interactive video with HTML5 and vanilla JavaScript</title>
</head>
<body>
<!-- Read my blog post on interactive videos: https://mostlydevstuff.com/2018/basic-interactive-video-with-html5-and-javascript/ -->
<style>

Custom Arch Linux live USB

Setup

Install the dependencies for the archiso package:

(root): pacman -S make squashfs-tools libisoburn dosfstools patch lynx devtools git

I recommend archiso getting them from git, there is a package in the repositories, however, at this time of writing, it will not work with the instructions below. So, grab the most recent version from git and install it:

(user): git clone git://projects.archlinux.org/archiso.git && cd archiso

@fearless-spider
fearless-spider / linux_count_files.md
Created February 15, 2021 19:54
Count files in directory

ls -l /var/www/html/mautic/var/spool/ | wc -l

@fearless-spider
fearless-spider / cors.py
Created November 22, 2020 00:01 — forked from mmerickel/cors.py
cors in pyramid
from pyramid.security import NO_PERMISSION_REQUIRED
def includeme(config):
config.add_directive(
'add_cors_preflight_handler', add_cors_preflight_handler)
config.add_route_predicate('cors_preflight', CorsPreflightPredicate)
config.add_subscriber(add_cors_to_response, 'pyramid.events.NewResponse')
class CorsPreflightPredicate(object):
@fearless-spider
fearless-spider / .git-commit-template
Created August 21, 2020 17:12 — forked from zakkak/.git-commit-template
This commit message template that helps you write great commit messages and enforce it across your team.
# [<tag>] (If applied, this commit will...) <subject> (Max 72 char)
# |<---- Preferably using up to 50 chars --->|<------------------->|
# Example:
# [feat] Implement automated commit messages
# (Optional) Explain why this change is being made
# |<---- Try To Limit Each Line to a Maximum Of 72 Characters ---->|
# (Optional) Provide links or keys to any relevant tickets, articles or other resources
# Example: Github issue #23