Skip to content

Instantly share code, notes, and snippets.

View floweb's full-sized avatar

Florian Le Frioux floweb

  • Seldon Finance
  • Basusarri, Euskal Herria, France
View GitHub Profile
@JoeyBurzynski
JoeyBurzynski / 55-bytes-of-css.md
Last active May 12, 2025 13:07
58 bytes of css to look great nearly everywhere

58 bytes of CSS to look great nearly everywhere

When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:

main {
  max-width: 38rem;
  padding: 2rem;
  margin: auto;
}
@M0r13n
M0r13n / README.md
Last active July 25, 2024 23:53
Logging with Loguru in Flask

This is a simple example of how to use loguru in your flask application

Just create a new InterceptHandler and add it to your app. Different settings should be configured in your config file, so that it is easy to change settings.

Logging is then as easy as:

from loguru import logger

logger.info("I am logging from loguru!")

@mikowl
mikowl / oneliners.js
Last active February 19, 2025 05:20
👑 Awesome one-liners you might find useful while coding.
// Inspired by https://twitter.com/coderitual/status/1112297299307384833 and https://tapajyoti-bose.medium.com/7-killer-one-liners-in-javascript-33db6798f5bf
// Remove any duplicates from an array of primitives.
const unique = [...new Set(arr)]
// Sleep in async functions. Use: await sleep(2000).
const sleep = (ms) => (new Promise(resolve => setTimeout(resolve, ms)));
// or
const sleep = util.promisify(setTimeout);
@vi
vi / split_by_silence.sh
Last active February 23, 2024 13:18
Using FFmpeg to split multimedia file into parts based on audio volume level
#!/bin/bash
IN=$1
OUT=$2
true ${SD_PARAMS:="-55dB:d=0.3"};
true ${MIN_FRAGMENT_DURATION:="20"};
export MIN_FRAGMENT_DURATION
if [ -z "$OUT" ]; then
@hsg
hsg / gist:6152944726e46ababcf47398398b4140
Created December 7, 2018 14:55
Client certificate authentication with Spring WebClient
public MyService(WebClient.Builder builder){
this.client = buildCustomWebClient(builder, "https://example.com");
}
private SslContext createSSLContext() {
try {
KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
keyStore.load(getClass().getClassLoader().getResourceAsStream(KEYSTORE_FILE), KEYSTORE_PASSWORD.toCharArray());
KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance("SunX509");
@valferon
valferon / postgres_manager.py
Created March 29, 2018 02:35
Python script to take care of postgres backup and restore of data
#!/usr/bin/python3
import argparse
import logging
import subprocess
import os
import tempfile
from tempfile import mkstemp
import configparser
import gzip
@brizandrew
brizandrew / server.py
Last active December 19, 2023 10:16
Simple Flask Webhook Example
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from flask import Flask, request
from urllib import unquote_plus
import json
import re
app = Flask(__name__)
@AndrewFarley
AndrewFarley / backup-gitlab-to-s3.sh
Created January 28, 2018 19:13
Gitlab Backup to S3
#!/bin/bash
LOGFILE=/tmp/backup-gitlab-to-s3.log
GITLAB_BACKUP_FOLDER=/var/opt/gitlab/backups
S3_FILE_PREFIX=gitlab
S3_BUCKET_PATH=bucket-name-goes-here/folder-here
SLACK_USERNAME="Backup Gitlab Daily - `hostname`"
SLACK_CHANNEL="#od-infra-monitoring"
SLACK_ICON="https://s3.amazonaws.com/kudelabs-archives/harddrive256.png"
@krohne
krohne / countdown.sh
Last active December 27, 2024 06:58
Countdown timer in bash shell script
#!/bin/bash
# $1 = # of seconds
# $@ = What to print after "Waiting n seconds"
countdown() {
secs=$1
shift
msg=$@
while [ $secs -gt 0 ]
do
printf "\r\033[KWaiting %.d seconds $msg" $((secs--))
@juhahinkula
juhahinkula / App.js
Last active February 22, 2024 11:56
React Native SQLite Courselist
import { useState, useEffect } from 'react';
import { StyleSheet, Text, TextInput, View, Button, FlatList } from 'react-native';
import * as SQLite from 'expo-sqlite';
const db = SQLite.openDatabase('coursedb.db');
export default function App() {
const [credit, setCredit] = useState('');
const [title, setTitle] = useState('');
const [courses, setCourses] = useState([]);