Skip to content

Instantly share code, notes, and snippets.

View arvati's full-sized avatar
💭
Studying online

Ademar Arvati arvati

💭
Studying online
View GitHub Profile
@marvinhagemeister
marvinhagemeister / bind-plugin.ts
Last active January 9, 2024 20:31
Preact Signals `bind:value`
import { options } from "preact";
import { Signal } from "@preact/signals";
// Add `bind:value` to JSX types
declare global {
namespace preact.createElement.JSX {
interface HTMLAttributes {
"bind:value"?: Signal<string | string[] | number | undefined>;
}
}
@leandronsp
leandronsp / 001-server.bash
Last active May 4, 2024 06:32
A complete yet simple Web server (with login & logout system) written in Shell Script
#!/bin/bash
## Create the response FIFO
rm -f response
mkfifo response
function handle_GET_home() {
RESPONSE=$(cat home.html | \
sed "s/{{$COOKIE_NAME}}/$COOKIE_VALUE/")
}
@nordineb
nordineb / README.md
Last active August 16, 2022 08:50
Azure DevOps, ssh-rsa, openssh

I wasn't able to git fetch from Azure DevOps repos after upgrading openssh on my computer.

ssh -V
  OpenSSH_8.8p1, OpenSSL 1.1.1l  24 Aug 2021

Turns out that OpenSSL has now turned off ssh-rsa by default:

This release disables RSA signatures using the SHA-1 hash algorithm by default.

But Azure DevOps doesn't support anything else... Add the following to your config file to re-enable ssh-rsa for Azure DevOps:

@zer0vuln
zer0vuln / Dockerfile
Last active March 27, 2024 17:53
Puppeteer with Alpine inside multi-staged Dockerfile
FROM node:13-alpine as base
LABEL maintainer="Isaak Eriksson <isaak.eriksson@gmail.com>"
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
ENV PUPPETEER_EXECUTABLE_PATH /usr/bin/chromium-browser
WORKDIR /src
RUN apk update && apk add --no-cache --virtual \
@ColonelJ
ColonelJ / SafeMath.sol
Last active March 28, 2023 18:02
Tronpix smart contract
pragma solidity ^0.5.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
@mikkeldamm
mikkeldamm / connection.js
Created June 16, 2019 10:08
zeit now 2.0 mongodb connection
let cachedMongoClient = null;
let cachedMongoDb = null;
exports.connect = async () => {
if (cachedMongoDb && cachedMongoClient && cachedMongoClient.isConnected()) {
return cachedMongoDb;
}
cachedMongoClient = await MongoClient.connect('MONGO_CONNECTION', { useNewUrlParser: true });
@richb-hanover
richb-hanover / Installing_Homenet.md
Last active January 6, 2021 09:32
Installing Homenet on LEDE/OpenWrt (DRAFT)

Installing Homenet on your Router

This set of instructions configures a fresh LEDE installation to run Homenet. They will likely work on a current build of OpenWrt.

There's lots of good info about Homenet elsewhere. See the External References section (below).

The general strategy is to connect your computer to the router's LAN Ethernet, convert the wireless and WAN interfaces to run Homenet, and test the changes so far. After things are working, configure the LAN Ethernet to Homenet through connect one of the (now Homenet) wireless interfaces.

  1. Install LEDE on your router. See the main Getting Started with LEDE page for details.
@ebidel
ebidel / app.html
Last active May 1, 2021 15:42
Fast Polymer app loading (Promises version) - optimized for first render, progressively enhanced lazy loading
<!DOCTYPE html>
<html>
<head>
<style>
body.loading #splash {
opacity: 1;
}
#splash {
position: absolute;
top: 0;
@julianlam
julianlam / expose-directory-on-host-to-lxc-container.md
Last active May 6, 2024 06:41
Exposing a directory on the host machine to an LXC container #blog

Exposing a directory on the host machine to an LXC container

  1. Log into the container and create an empty directory, this will be the mount point
  2. Log out and stop the container.
  3. Open to your container's config file
    • For regular LXC containers: /var/lib/lxc/mycontainer/config
    • For unprivileged LXC containers: $HOME/.local/share/lxc/mycontainer/config
  4. Add a new line above the lxc.mount directive, that follows the format below. Substitute proper paths as necessary:
    • lxc.mount.entry = /path/to/folder/on/host /path/to/mount/point none bind 0 0
  • Both of these paths are relative to the host machine.