Skip to content

Instantly share code, notes, and snippets.

function writeDocs() {
// new line
changedDocs = [];
// end of new line
if (currentBatch.docs.length === 0) {
return;
}
var docs = currentBatch.docs;
return target.bulkDocs({docs: docs, new_edits: false}).then(function (res) {
if (returnValue.cancelled) {
;;; centered-window-mode.el --- Center the text when there's only one window
;;
;; Copyright (C) 2014 Anler Hp <http://anler.me>
;;
;; Author: Anler Hp <http://anler.me>, Mickael Kerjean <mickael.kerjean@gmail.com>
;; Version: 0.0.2
;; Keywords: faces, windows
;; URL: https://github.com/ikame/centered-window-mode
;; Compatibility: GNU Emacs 23.x, GNU Emacs 24.x
;;
@mickael-kerjean
mickael-kerjean / puml-mode.el
Created January 21, 2016 04:50
emacs puml-mode patch
;;; puml-mode.el --- Major mode for PlantUML -*- lexical-binding: t; -*-
;; Filename: puml-mode.el
;; Description: Major mode for PlantUML diagrams sources
;; Compatibility: Tested with Emacs 24.3 through 24.5 on OS X 10.10
;; Author: Zhang Weize (zwz)
;; Maintainer: Carlo Sciolla (skuro)
;; Keywords: uml plantuml ascii
;; Version: 0.6.2
;; https://github.com/dholm/benchmark-init-el
;; (add-to-list 'load-path "~/.emacs.d/lisp/plugins/benchmark-init")
;; (require 'benchmark-init-loaddefs)
;; (benchmark-init/activate)
;; -------------------------------------------------------------------------------------
;; --------------------- SHORTCUTS -----------------------------------------
;; -------------------------------------------------------------------------------------
;; LISP
@mickael-kerjean
mickael-kerjean / serialiser.js
Created February 28, 2018 04:21
Form data as json object
const serialize = function($form){
if(!$form) return {};
var obj = {};
var elements = $form.querySelectorAll( "input, select, textarea" );
for( var i = 0; i < elements.length; ++i ) {
var element = elements[i];
var name = element.name;
var value = element.value;
if(name){
obj[name] = value;
@mickael-kerjean
mickael-kerjean / install_node.sh
Last active July 13, 2023 11:35
kubernetes install script
#!/bin/bash
set -e
# run like this:
# /bin/bash -c "$(curl -fsSL https://xxx)"
VERSION=1.27
########################
# docker stuff: https://kubernetes.io/docs/setup/production-environment/container-runtimes/
@mickael-kerjean
mickael-kerjean / install_ingress.sh
Last active June 3, 2020 06:00
install_ingress.sh
---
kind: DaemonSet
apiVersion: apps/v1
metadata:
name: traefik-ingress-controller
namespace: kube-system
labels:
k8s-app: traefik-ingress-lb
spec:
selector:
@mickael-kerjean
mickael-kerjean / render.js
Last active November 23, 2020 22:28
markdown self render
function addLinkToHead(url) {
let $link = document.createElement("link")
$link.setAttribute("rel", "stylesheet")
$link.setAttribute("href", url)
document.head.appendChild($link)
}
function addScriptToHead(url) {
let $script = document.createElement("script")
$script.setAttribute("src", url)
@mickael-kerjean
mickael-kerjean / webdav.go
Last active May 10, 2022 19:16
minimal webdav server
// go mod init example.com && go get .
// CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o webdav.bin main.go
package main
import (
"fmt"
"github.com/google/go-webdav"
"github.com/google/go-webdav/memfs"
"net/http"
@mickael-kerjean
mickael-kerjean / sftp.go
Last active August 26, 2022 08:37
sftp
/*
* Build steps:
* 1. go generate -x ./index.go
* 2. go build -o sftp.bin index.go
*/
package main
import (
_ "embed"
"fmt"