Skip to content

Instantly share code, notes, and snippets.

View sbusso's full-sized avatar
🤖
Crafting with AI friends

Stéphane Busso sbusso

🤖
Crafting with AI friends
View GitHub Profile
@sbusso
sbusso / youtubemusicdownloader.py
Created August 19, 2023 22:46 — forked from un1tz3r0/youtubemusicdownloader.py
This script uses ytmusicapi and pytube together to download your playlists, history or 'liked' songs as high-quality audio-only streams from Youtube Music.
''' This script uses ytmusicapi and pytube together to download your playlists, history or 'liked' songs as
high-quality audio-only streams from Youtube Music, which are protected by a "signatureCipher" obfuscation scheme.
To use it, first install [ytmusicapi] and [pytube] using pip, then follow the instructions for creating the auth
file from the response in an authenticated session to a watch-page request as found in your browser's dev-tools.
The downloaded files are placed in ~/Music, named with the artist and track metadata, and will be skipped instead
of downloaded again next time it is run, based on the videoIds of the downloaded songs.
Merry Xmas - V.
@sbusso
sbusso / Readme.md
Created January 6, 2022 04:27 — forked from deathau/Readme.md
Obsidian scss

Obsidian SASS theme switching tools

I was building up a small library of css snippets, and mixing and matching via copy-paste was getting tiresome.
So, I knocked myself up a little solution using https://sass-lang.com/
To use this solution, you need to follow the instructions on the website to install the SASS command line utility.

Instructions

For my purposes, I created a subfolder in my Obsidian vault called ./.themes where my obsidian.scss file lives. I also created a subfolder for mixins (./.themes/mixins) containing small snippets like "Andy Matuschak" mode and collapsing sidebars (and my preferred custom colours for my Base2Tone theme)

const apiUrl = "http://api.quotable.io/random?tags=";
async function start() {
var quote;
var cite;
const response = await fetch(apiUrl);
const data = await response.json();
if (response.ok) {
// Update DOM elements
@sbusso
sbusso / meltimagesslideshowbob.sh
Created June 28, 2020 06:23 — forked from bikubi/meltimagesslideshowbob.sh
Create a slideshow from images, with blending, using ffmpeg or MLT
#!/bin/bash
# create a slideshow from images, with nice blending
# using MLT or ffmpeg
# adapted from https://superuser.com/a/834035
#
# beware of the ffmpeg command, it eats memory quickly
# USAGE
# 1 pass images as arguments
@sbusso
sbusso / Rakefile
Created December 7, 2019 21:34 — forked from schickling/Rakefile
Activerecord without Rails
require "active_record"
namespace :db do
db_config = YAML::load(File.open('config/database.yml'))
db_config_admin = db_config.merge({'database' => 'postgres', 'schema_search_path' => 'public'})
desc "Create the database"
task :create do
ActiveRecord::Base.establish_connection(db_config_admin)
@sbusso
sbusso / Embedding GoLang into a Ruby application.md
Created November 12, 2018 02:37 — forked from schweigert/Embedding GoLang into a Ruby application.md
Embedding GoLang into a Ruby application - Blogpost to Magrathealabs

Go Title

I am passionate about Ruby, but its execution time compared to other languages is extremely high, especially when we want to use more complex algorithms. In general, data structures in interpreted languages become incredibly slow compared to compiled languages. Some algorithms such as ´n-body´ and ´fannkuch-redux´ can be up to 30 times slower in Ruby than Go. This is one of the reasons I was interested in embedding Go code in a Ruby environment.

For those who do not know how shared libraries operate, they work in a similar way as DLLs in Windows. However, they have a native code with a direct interface to the C compiler.

Note Windows uses the DLL system, and in this case, this does not necessarily have to be in native code.

One example is DLLs written in C#, which runs on a virtual machine. Because I do not use windows, I ended up not testing if it is poss

@sbusso
sbusso / _results
Created September 30, 2018 13:51 — forked from alexedwards/_results
SCS and Gorilla Sessions benchmarks
# SCS
BenchmarkSCSMemstore-8 200000 9573 ns/op 3643 B/op 49 allocs/op
BenchmarkSCSCookies-8 100000 23220 ns/op 7516 B/op 83 allocs/op
BenchmarkSCSRedis-8 30000 45783 ns/op 4459 B/op 76 allocs/op
BenchmarkSCSMySQL-8 300 5782698 ns/op 4382 B/op 73 allocs/op
BenchmarkSCSPostgres-8 500 3715685 ns/op 5585 B/op 96 allocs/op
# Gorilla
@sbusso
sbusso / Editor.vue
Created September 28, 2018 03:05 — forked from stevebauman/Editor.vue
VueJS 2 + Trix Editor V-Model Component
<template>
<div></div>
</template>
<script>
import Trix from 'trix';
export default {
props: ['value'],
@sbusso
sbusso / letitfail.go
Created September 24, 2018 21:58 — forked from campoy/letitfail.go
This example shows how to have a set of goroutines running concurrently and processing requests. Panics from goroutines are recovered and the worker is restarted. You can download it and run it directly using `go run letitfail.go`
package main
import (
"bufio"
"fmt"
"os"
"time"
)
const numWorkers = 3
@sbusso
sbusso / unixhttpc.go
Created September 24, 2018 11:23 — forked from teknoraver/unixhttpc.go
HTTP over Unix domain sockets in golang
package main
import (
"context"
"flag"
"fmt"
"io"
"net"
"net/http"
"os"