Home Search Login / Register
git-list-loc.sh bnjmn 8 months ago
git ls-files | xargs wc -l
construction.css bnjmn 9 months ago
div {
  background: yellow repeating-linear-gradient(45deg, orange, orange 12px, yellow 5px, yellow 25px);
  width: 100%;
  color: black;
  font-family: arial;
  font-weight: bold;
  padding: 1rem;
  margin: 0 auto;
  text-align: center;
}
openemoji.org.html bnjmn 9 months ago
<html>
<script>
    function get_emoji(emoji) {
        let emoji_code = [...emoji].map(e => e.codePointAt(0).toString(16)).join(`-`).toUpperCase();
        new_url = `https://openmoji.org/data/color/svg/${emoji_code}.svg`
        document.write(`<img src=${new_url} style="height: 80px;">`);
    }
    get_emoji("🦴")
    get_emoji("🎭")
    get_emoji("👩‍⚕️")
</script>
</html>
genproxy.sh bnjmn 9 months ago
#!/bin/bash

while getopts "d:i:p:c:k:" opt; do
    case $opt in
    d) domain="$OPTARG" ;;
    i) ip="$OPTARG" ;;
    p) port="$OPTARG" ;;
    c) cert_path="$OPTARG" ;;
    k) key_path="$OPTARG" ;;
    esac
done

if [ -z "$domain" ] || [ -z "$ip" ] || [ -z "$port" ] || [ -z "$cert_path" ] || [ -z "$key_path" ]; then
    echo "Usage: $0 -d <domain> -i <ip> -p <port> -c <certificate_path> -k <key_path>"
    exit 1
fi

nginx_config="/etc/nginx/sites-available/$domain"

# Define color codes
YELLOW="\033[33m"
RESET="\033[0m"

# Text
UNDERLINE=$(tput smul)

# Pretty print stuff
printf "${YELLOW}${UNDERLINE}Configuration Summary${RESET}\n"
printf "${YELLOW}Domain:${RESET} $domain\n"
printf "${YELLOW}IP:${RESET} $ip\n"
printf "${YELLOW}Port:${RESET} $port\n"
printf "${YELLOW}Certificate Path:${RESET} $cert_path\n"
printf "${YELLOW}Key Path:${RESET} $key_path\n"

read -p "Continue (y/n)? " CONT
CONT=${CONT,,} # Convert to lowercase

if [ "$CONT" = "y" ]; then
    echo "server {
    listen 80; # listen on IPv4
    listen [::]:80; # listen on IPv6

    server_name $domain;

    location / {
        proxy_pass http://$ip:$port;
        include proxy_params;
    }

    listen 443;
        listen [::]:443;

    ssl_certificate $cert_path;
    ssl_certificate_key $key_path;
}" >"$nginx_config"
    ln -s "$nginx_config" "/etc/nginx/sites-enabled"
    systemctl reload nginx
    echo "nginx configuration created for $domain at $nginx_config"
else
    exit 0
fi
half-bg.css bnjmn 9 months ago
selector {
    background-image: linear-gradient(to bottom, transparent 50%, green 50%);
}
hover-move.css bnjmn 10 months ago
img:hover {
	transform: translateY(-8pt);
	transition: ease-in-out 0.2s;
}
source-config.sh bnjmn 10 months ago
[ -f /etc/resolv.conf ] && source /etc/resolve.conf # test if file exists and short-circuit
hacker-text.css bnjmn 10 months ago
color: #B2F2BB;
text-shadow: rgba(140, 233, 154, 0.5) 0px 0px 30px; /* color offset-x offset-y blur-radius */
overlapping-img.css bnjmn 10 months ago
img {
  display:inline-block;
}
img:nth-of-type(odd) {
  transform: rotate(10deg);
}
img:nth-of-type(even) {
  transform: rotate(-10deg);
}
file-blob.js bnjmn 10 months ago
const todos = [{
  task: "walk the dog"
}, {
  task: 'eat pizza'
}]

const blob = new Blob([JSON.stringify(todos)], {
  type: "application/json",
})

const file = new File([blob], "my-todos", {
  type: "application/json"
}) // new File(bits, name, options)

file.name // "my-todos"

await blob.text()
await file.text()

// difference: files have names
// https://stackoverflow.com/questions/61277500/whats-the-difference-between-blob-objects-and-file-objects-in-js
nginx.yml bnjmn 10 months ago
version: '3.8'

services:
  nginx:
    image: nginx:latest
    ports:
      - "32080:80"
    volumes:
      - ./data:/usr/share/nginx/html 
weird-web.md bnjmn 10 months ago

"We are tired of living in an online world where people are isolated from each other on boring, generic social networks that don't let us truly express ourselves. It's time we took back our personalities from these sterilized, lifeless, monetized, data mined, monitored addiction machines and let our creativity flourish again." - Neocities

box-shadow.css bnjmn 10 months ago
/* Keyword values */
box-shadow: none;

/* offset-x | offset-y | color */
box-shadow: 60px -16px teal;

/* offset-x | offset-y | blur-radius | color */
box-shadow: 10px 5px 5px black;

/* offset-x | offset-y | blur-radius | spread-radius | color */
box-shadow: 2px 2px 2px 1px rgba(0, 0, 0, 0.2);

/* inset | offset-x | offset-y | color */
box-shadow: inset 5em 1em gold;

/* Any number of shadows, separated by commas */
box-shadow:
  3px 3px red,
  -1em 0 0.4em olive;

/* Global values */
box-shadow: inherit;
box-shadow: initial;
box-shadow: revert;
box-shadow: revert-layer;
box-shadow: unset;
linear-gradient.css bnjmn 10 months ago
background: linear-gradient(135deg, orange, purple)
webshare-api.js bnjmn 10 months ago
shareBtn.addEventListener("click", async () => {
  try {
    const shareData = {
      title: document.title,
      text: `PublicBin · ${document.title} ·`,
      url: window.location.href,
    };
    await navigator.share(shareData);
  } catch (err) {
    console.log(err);
  }
});
fix-h-scroll.css bnjmn 10 months ago
word-wrap: break-word;
white-space: pre-wrap;
delete-all-cookies.js bnjmn 10 months ago
// https://stackoverflow.com/questions/179355/clearing-all-cookies-with-javascript

document.cookie.split(";").forEach(function (c) {
  document.cookie = c
  .replace(/^ +/, "")
  .replace(/=.*/,"=;expires=" + new Date().toUTCString() + 
  ";path=/");
}); 
markdown-example.md bnjmn 10 months ago

Header 1

Header 2

Header 3

Header 4

Header 5
Header 6

Italics Bold Strikeout

  • Bulleted list item a
  • Bulleted list item b
    • Nested item b1
  1. Numbered list item
  2. Numbered list item
    1. Nested list item
    2. Nested list item
  •  Checkbox 1
  •  Checkbox 2