Skip to content

Instantly share code, notes, and snippets.

@fdelbos
fdelbos / random_string.sql
Created February 23, 2024 05:56
A function to generate a random URL safe string with PostgreSQL
create or replace function random_string(nb_bytes integer)
returns text
as $$
select
trim('='
from
(
select
replace ( (
select
@fdelbos
fdelbos / golang_android.md
Last active April 20, 2023 06:18
Build and install a go library for android studio
@fdelbos
fdelbos / days.sh
Created February 18, 2023 02:15
A shell script to calculate the days between 2 dates with postgres
#!/bin/sh
echo "Use the following format: yyyy-mm-dd (ex: 2022-01-15)"
echo "First day: "
read FIRST_DAY
echo "Last day: "
read LAST_DAY
@fdelbos
fdelbos / STM32 project setup.md
Last active February 10, 2023 03:59
STM32 project setup with cmake and CubeMX

STM32 project setup

Tools

Install gcc arm none eabi

We will install gcc in an upper directory, so that we can reuse it in all our projects

  • create the dir: mkdir stm32 && cd stm32
  • go to the download page and find the latest version
@fdelbos
fdelbos / Configuring Qt 6.x and CMake for windows 10.md
Last active February 10, 2023 03:58
Configuring Qt 6.x and CMake for windows 10

Configuring Qt 6.x and CMake for windows 10

If you want to create a redistributable installer for a Qt app with Cmake then youve come to the right place... I ve been struggling to make Qt work with cmake on windows, and finally figure out something that works:

  1. Go ahead and download Qt: https://www.qt.io/download-qt-installer

  2. Start the install and select "Custom installation" image11

@fdelbos
fdelbos / gunicornd
Created September 17, 2011 00:04
A FreeBSD startup script for starting Gunicorn workers
#!/bin/sh
#
# PROVIDE: gunicornd
#
@fdelbos
fdelbos / .bashrc
Last active June 7, 2020 08:49
base docker config files
BLOCKSIZE=m; export BLOCKSIZE
PAGER=less; export PAGER
export CLICOLOR=1
export LSCOLORS=GxFxCxDxBxegedabagaced
export HISTCONTROL=ignoreboth:erasedups
alias l='ls -lah'
alias c='cat'
alias e='emacs'
@fdelbos
fdelbos / FreeBSD_node_monit.md
Last active February 17, 2020 13:38
FreeBSD 10 Nodejs setup with nginx, mongo and monit

FreeBSD 10 Nodejs setup with nginx, mongodb, redis and monit

This my receipe for installing a complete nodejs server on FreeBSD 10. The parameters used in this configuration are for a very small private server that I use for demo purpose only, so for a production server, you should somehow set the limits in pair with your ressources.

I use monit so I don't have to write rc scripts for node and it should take care of process lifecycle management for me. Alternatives exists such as supervisord or circus.

Installing mongodb

@fdelbos
fdelbos / TJSONProtocol.py
Created October 24, 2012 20:35
A Python JSON implementation of the Thrift protocol
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
@fdelbos
fdelbos / .emacs
Last active July 6, 2018 08:10
be .emacs
;; melpa
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
(package-initialize)
;; theme
(load-theme 'manoj-dark)
(global-linum-mode t)