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
@webcss
webcss / firedemo.js
Last active April 8, 2019 23:46
Firebase client for Mithril
// mithrilFire usage demo
// using firebase database "dinosaur-facts"
var Dinosaurs = {
model: function() {
// return a firebase reference to our database
return new Firebase('https://dinosaur-facts.firebaseio.com');
},
controller: function() {
var data = Dinosaurs.model();
@julianlam
julianlam / expose-directory-on-host-to-lxc-container.md
Last active July 9, 2024 14:16
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.
@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;
@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.
@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 });
@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
@myisaak
myisaak / Dockerfile
Last active July 8, 2024 08:56
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 \
@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:

@leandronsp
leandronsp / 001-server.bash
Last active July 18, 2024 08:54
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/")
}