Skip to content

Instantly share code, notes, and snippets.

View adelin-b's full-sized avatar
🎯
Focusing

Adelin Berard adelin-b

🎯
Focusing
  • Paris
View GitHub Profile
@adelin-b
adelin-b / README-Template.md
Created February 21, 2019 12:38 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@adelin-b
adelin-b / svg2ico.sh
Created March 30, 2019 13:37 — forked from azam/svg2ico.sh
Convert SVG to ICO using ImageMagick, with transparent background and multi-size icons
convert -density 384 -background transparent favicon.svg -define icon:auto-resize -colors 256 favicon.ico
@adelin-b
adelin-b / deploy_api.sh
Created June 19, 2020 19:13
rsync deploy
#!/bin/bash
# DEPLOY_USER=ubuntu
# DEPLOY_SERVER=
# DEPLOY_SSH=$DEPLOY_USER@$DEPLOY_SERVER:$DEPLOY_DIR
SSH_SERVER_NAME=ssh_config_name
DEPLOY_DIR=/home/admin/deploy/
DEPLOY_SSH=$SSH_SERVER_NAME:$DEPLOY_DIR
EXLUDE_FILE=.rsync_exclude
set -e
@adelin-b
adelin-b / json-literal-typer.ts
Created July 12, 2020 16:07
small yargs cli for json-literal-typer using ts-node
#!/usr/bin/env ts-node
import * as yargs from 'yargs';
import { default as analyze, typify } from 'json-literal-typer';
import * as fs from 'fs';
const argv = yargs
.option('output', {
alias: 'o',
description: 'output file',
type: 'string',
@adelin-b
adelin-b / norgtion.org
Created September 3, 2020 18:58
notion layout attempt with org mode

[1/4] Media

La fin du

@adelin-b
adelin-b / compare.md
Created October 12, 2020 15:49
Plant Uml example for react and C4
!include https://raw.githubusercontent.com/RicardoNiepel/C4-PlantUML/release/1-0/C4_Container.puml

@startuml 
Person(personAlias, "Label", "Optional Description")
Container(containerAlias, "Label", "Technology", "Optional Description")
System(systemAlias, "Label", "Optional Description")
System(holla, "Holla", "Optional Description")
@adelin-b
adelin-b / timeout.ts
Created October 14, 2020 00:01
A timeout that can be awaited
/**
* A timeout that can be awaited
* @param {} ms
*/
export function timeout(ms: number) {
return new Promise((resolve) => setTimeout(resolve, ms))
}
@adelin-b
adelin-b / isDescendant.ts
Last active October 14, 2020 00:12
Check if a dom element is the descendant from another element with matching id
/** Check if a dom element is the descendant from another element with matching id */
export const isDescendant = (element: HTMLElement, parentId: string, depth: number) => {
let isChild = false
if (element.id === parentId) {
//is this the element itself?
isChild = true
}
let iterations = 0
@adelin-b
adelin-b / OptionsApp.tsx
Last active October 16, 2020 22:45
Auto-generate forms from typescript interface
import * as React from 'react'
import styled from 'styled-components'
import schemaJson from './form.json'
// import Form from '@rjsf/material-ui'
import Form from '@rjsf/core'
// console.log('schema: ', schema)
export interface OptionSettings {
whitelist: string[]
@adelin-b
adelin-b / ankiToOrg.ts
Last active May 3, 2022 05:05
A script to convert anki file to org file using anki-connect anki plugin and anki-editor for emacs `deno run --allow-net anki.ts "*"` or `deno run --allow-net anki.ts "Deckname"` or inside emacs evil mode `:read !deno run --allow-net anki.ts "*"` WARNING, currently anki-editor break html by escaping it automaticaly when you push the imported decks
const notesInfo = (results: any[]) => ({
action: "notesInfo",
version: 6,
params: {
notes: results,
},
});
const deckname = Deno.args[0] ?? "*";