Skip to content

Instantly share code, notes, and snippets.

View solisoft's full-sized avatar
🏠
Working from home

BONNAURE Olivier solisoft

🏠
Working from home
View GitHub Profile
@solisoft
solisoft / redis.lua
Last active January 5, 2024 19:16
Redbean Redis Client
package.path = package.path .. ";.lua/?.lua"
local db_config = {
db_name = "db_delupay",
url = "http://localhost:8529",
username = "root",
password = "3fe2003d-6f42-474f-aa43-1dde7a2a2bf1"
}
redis = require 'redis'
<!DOCTYPE html>
<html lang="{{ lang }}">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
@headers
<link rel="stylesheet" href="@css_vendors" />
<link rel="stylesheet" href="@css" />
</head>
<body>
@solisoft
solisoft / reorder.aql
Created March 5, 2019 19:26
ArangoDB / AQL : reorder collection
LET docs = (FOR doc IN @@collection SORT doc._key RETURN doc)
FOR i IN (0..(LENGTH(docs) - 1))
LET doc = docs[i]
UPDATE({ _key: doc._key, order: i }) IN @@collection
version: '3'
services:
arangodb:
image: arangodb:3.4.1
restart: always
environment:
ARANGO_ROOT_PASSWORD: XXXX
volumes:
- db-data:/var/lib/arangodb3
require 'net/http'
require 'json'
DB_USER_SRC = 'root'.freeze
DB_USER_DST = 'root'.freeze
DB_PASS_SRC = 'XXXX'.freeze
DB_PASS_DST = 'XXXX'.freeze
DB_ENDPOINT_SRC = 'http+tcp://0.0.0.0:8529'.freeze
DB_ENDPOINT_DST = 'http+tcp://0.0.0.0:9529'.freeze
DUMP_PATH = '/home/dump/'.freeze # must exist

Keybase proof

I hereby claim:

  • I am solisoft on github.
  • I am solisoft (https://keybase.io/solisoft) on keybase.
  • I have a public key ASBwAVlHY7lCxAqmsYdT_oq5hh8cRh9Fbgr25LZKUe8_Xwo

To claim this, I am signing this object:

@solisoft
solisoft / main.js
Last active November 27, 2017 14:07
ArangoDB Multipart/formdata
'use strict';
const db = require('@arangodb').db;
const joi = require('joi');
const _ = require('lodash');
const createRouter = require('@arangodb/foxx/router');
const router = createRouter();
const querystring = require('querystring');
const crypt = require('@arangodb/crypto');
const fs = require("fs")
@solisoft
solisoft / auth.js
Created November 23, 2017 13:56
Authentification endpoint
'use strict';
const db = require('@arangodb').db;
const joi = require('joi');
const createRouter = require('@arangodb/foxx/router');
const sessionsMiddleware = require('@arangodb/foxx/sessions');
const jwtStorage = require('@arangodb/foxx/sessions/storages/jwt');
const createAuth = require('@arangodb/foxx/auth');
const auth = createAuth();
const router = createRouter();
@solisoft
solisoft / install_ruby_1-9-3.sh
Created August 24, 2017 07:51
Install ruby 1.9.3 within rbenv & archlinux
curl -fsSL https://gist.github.com/FiveYellowMice/c50490693d47577cfe7e6ac9fc3bf6cf.txt | PKG_CONFIG_PATH=/usr/lib/openssl-1.0/pkgconfig:/usr/lib/pkgconfig rbenv install --patch 1.9.3-p551
require "kemal"
require "jwt"
require "json"
require "yaml"
require "arangocr"
require "redis"
# Load .env file
env_data = YAML.parse File.read(".env.yml") rescue Hash(String, String).new
env_data.each { |k, v| ENV[k.to_s] = v.to_s }