Skip to content

Instantly share code, notes, and snippets.

View vdegenne's full-sized avatar
🈳

Valentin Degenne vdegenne

🈳
View GitHub Profile
find . -iname "*.js" | xargs clang-format --style=file -i
#!/usr/bin/env node
const highFive = () => new Promise((res, rej) => {
res('clap!');
});
(async function() {
// 1. correct but prefer syntax 2
await highFive()
.then((res) => {
[vdegenne /u/l/firewalld]$ docker run --rm --name pizz -p 80:8080 -e PG_HOST=DOCKER_HOST pizzajerry
docker: Error response from daemon: driver failed programming external connectivity on endpoint pizz (6a66a1d6c68be59114f619f22d568645bb4d0f4efd195495a0292bf12720693a): (COMMAND_FAILED: '/usr/sbin/iptables -w2 -t nat -A DOCKER -p tcp -d 0/0 --dport 80 -j DNAT --to-destination 172.17.0.2:8080 ! -i docker0' failed: ).
import { LitElement, html } from 'lit-element'
import '@material/mwc-dialog'
import '@material/mwc-button'
class OurApp extends LitElement {
render() {
return html`
<mwc-dialog title="Are you sure ?" open @closed=${this.onDialogClose}>
<div>are you sure to perform this action ?</div>
<mwc-button slot=secondaryAction dialogAction=no></mwc-button>
@vdegenne
vdegenne / index.html
Last active September 27, 2019 16:54
entry point that the client will request
<!doctype html>
<html>
<head>
<title>our app</title>
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" rel="stylesheet">
</head>
<body>
<our-app></our-app>
<script src=bundle.js></script>
</body>
import resolve from 'rollup-plugin-node-resolve'
export default {
input: './our-app.js',
output: { file: './bundle.js', format: 'iife' },
plugins: [resolve()]
}
@vdegenne
vdegenne / pm2logs
Last active January 15, 2020 15:54
Open the pm2 logs of the current project (current directory)
#!/usr/bin/bash
pm_id=$(node <<EOF
const pm2_processes = `pm2 jlist`;
const pm2_process = pm2_processes.filter(proc => proc.pm2_env.pm_cwd === "`pwd`");
if (pm2_process.length) {
// one process found
console.log(pm2_process[0].pm_id)
process.exit(0);
}
@vdegenne
vdegenne / install-postgresql-10-debian.md
Last active April 21, 2021 11:33
Install postgresql 10 on Debian

Install postgresql 10 on Debian (stretch)

echo "deb [arch=amd64] http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main" > /etc/apt/sources.list.d/pgdg.list
curl -sSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt update
sudo apt install -y postgresql-10 postgresql-10 postgresql10-contrib

After installation the server is already running the main instance :

@vdegenne
vdegenne / install-postgresql-12-red-hat.md
Last active May 14, 2022 07:40
Install PostgreSQL 12 on Red Hat distributions (tested on fedora 31)

General

First go on this page https://www.postgresql.org/download/linux/redhat/ and complete the form and follow the instructions.

Both the client and the server should be installed

sudo dnf install -y postgresql12
sudo dnf install -y postgresql12-server

Defining a channel

channel.js

import { Channel } from 'channel-library'

export const channel = new Channel()

Consuming