Skip to content

Instantly share code, notes, and snippets.

View Cretezy's full-sized avatar

Cretezy

View GitHub Profile
@Cretezy
Cretezy / nvim-recent.lua
Last active May 11, 2024 05:02
Quick recent file picker in Neovim/Telescope
return {
{
"mollerhoj/telescope-recent-files.nvim",
config = function() require("telescope").load_extension("recent-files") end,
keys = {
{
"<Tab>",
function()
require("telescope").extensions["recent-files"].recent_files({
attach_mappings = function(_, map)

Timeline

  1. Pre-development
    1. Agree on featureset
    2. Designs
    3. Pick tech stack ([see below](#Tech stack))
  2. Development
  3. Release
    1. Link from astronvim.com / AstroCommunity repo
@Cretezy
Cretezy / systemd-user-fix.md
Created May 21, 2017 18:38
systemd user "Failed to connect to bus: No such file or directory"

Simply add this snippet...

export XDG_RUNTIME_DIR="/run/user/$UID"
export DBUS_SESSION_BUS_ADDRESS="unix:path=${XDG_RUNTIME_DIR}/bus"

...to .bashrc or .zshrc or any file ran on login.

@Cretezy
Cretezy / Shout.md
Last active October 13, 2021 01:34
ShoutPlay.js

Simple script to stream a file from Node.js to Icecast (or any libshout compatible server) using nodeshout.

Usage

const shout = ... // Shout instance
const songPath = 'song.ogg';
const playing = play(shout, songPath);
playing.on("finish", ()=>{
  // Do something (e.g.: play next song)
});
@Cretezy
Cretezy / Commands.md
Last active April 17, 2021 15:58
Forgetful Linux Commands

Mostly made for Debian/Ubuntu. Might work with other distributions/setup, be careful.

Spotify scaling

Make Spotify DPI factor of 2.1 (override)

cp /usr/share/applications/spotify.desktop ~/.local/share/applications/
sed -i 's/Exec=spotify %U/Exec=spotify --force-device-scale-factor=2.1 %U/g' ~/.local/share/applications/spotify.desktop
@Cretezy
Cretezy / 420MazeIt.cs
Last active June 25, 2020 01:03
Unity Basic Prim Maze Generator
using UnityEngine;
using System.Collections;
public class Mazer : MonoBehaviour
{
ArrayList walls = new ArrayList ();
ArrayList cells = new ArrayList ();
void MazeIt ()
{

Contributor License Agreement

The following terms are used throughout this agreement:

  • You - the person or legal entity including its affiliates asked to accept this agreement. An affiliate is any entity that controls or is controlled by the legal entity, or is under common control with it.
  • Project - is an umbrella term that refers to any and all of Charles-William Crete's open source projects.
  • Contribution - any type of work that is submitted to a Project, including any modifications or additions to existing work.
  • Submitted - conveyed to a Project via a pull request, commit, issue, or any form of electronic, written, or verbal communication with Charles-William Crete, contributors or maintainers.

1. Grant of Copyright License.

import 'package:flutter_super_state/flutter_super_state.dart';
import 'package:state_test/src/store/counter.dart';
class AuthModule extends StoreModule {
int get isLoggedIn => isLoggedIn;
var _isLoggedIn = false;
AuthModule(Store store) : super(store);
Future<void> login() async {
import 'package:flutter_super_state/flutter_super_state.dart';
// Modules extend `StoreModule`
class CounterModule extends StoreModule {
// Read only property, to avoid accidentally setting `counter` without calling `setState`
int get counter => _counter;
var _counter = 0;
// This automatically registers your module to your store
CounterModule(Store store): super(store);
void main() {
// Create the store
final store = Store();
// Register modules
CounterModule(store);
AuthModule(store);
// Provide store to whole application
runApp(StoreProvider(