Skip to content

Instantly share code, notes, and snippets.

@recca0120
recca0120 / venv.fish
Created February 23, 2024 20:00 — forked from tommyip/venv.fish
venv.fish - Automatically activate/deactivate virtualenv in fish shell
# Based on https://gist.github.com/bastibe/c0950e463ffdfdfada7adf149ae77c6f
# Changes:
# * Instead of overriding cd, we detect directory change. This allows the script to work
# for other means of cd, such as z.
# * Update syntax to work with new versions of fish.
# * Handle virtualenvs that are not located in the root of a git directory.
function __auto_source_venv --on-variable PWD --description "Activate/Deactivate virtualenv on directory change"
status --is-command-substitution; and return
@recca0120
recca0120 / axios.js
Created February 19, 2024 08:08 — forked from matthewsuan/axios.js
Axios request queue-like that limits number of requests at any given time
import axios from 'axios'
const MAX_REQUESTS_COUNT = 5
const INTERVAL_MS = 10
let PENDING_REQUESTS = 0
// create new axios instance
const api = axios.create({})
/**
@recca0120
recca0120 / README.en.md
Created November 8, 2023 20:40 — forked from niw/README.en.md
How to run Windows 10 on ARM or Ubuntu for ARM64 in QEMU on Apple Silicon Mac

How to run Windows 10 on ARM or Ubuntu for ARM64 in QEMU on Apple Silicon Mac

Here is easy steps to try Windows 10 on ARM or Ubuntu for ARM64 on your Apple Silicon Mac. Enjoy!

NOTE: that this is current, 10/1/2021 state.

Running Windows 10 on ARM

  1. Install Xcode from App Store or install Command Line Tools on your Mac

Mounting VirtualBox shared folders on Ubuntu Server 18.04 LTS (Bionic Beaver)

This guide will walk you through the steps on how to setup a VirtualBox shared folder inside your Ubuntu Server guest.

Prerequisites

This guide assumes that you are using the following setup:

You could still make this guide work with other setups (possibly with some modifications to the commands and whatnot).

@recca0120
recca0120 / PageTemplates_Faq.php
Created August 2, 2023 00:31 — forked from pxlrbt/PageTemplates_Faq.php
Filament Template
<?php
namespace App\Filament\PageTemplates;
use Filament\Forms\Components\Repeater;
use Filament\Forms\Components\RichEditor;
use Filament\Forms\Components\TextInput;
final class Faq
{
#!/bin/sh
### BEGIN INIT INFO
# Provides: dockercompose
# Required-Start: $docker
# Required-Stop: $docker
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Docker Services
### END INIT INFO
@recca0120
recca0120 / README.md
Created November 9, 2021 16:24 — forked from mosquito/README.md
Add doker-compose as a systemd unit

Docker compose as a systemd unit

Create file /etc/systemd/system/docker-compose@.service. SystemD calling binaries using an absolute path. In my case is prefixed by /usr/local/bin, you should use paths specific for your environment.

[Unit]
Description=%i service with docker compose
Requires=docker.service
After=docker.service
@recca0120
recca0120 / README.md
Created November 9, 2021 16:22 — forked from Luzifer/README.md
Running docker-compose as a systemd service

Running docker-compose as a systemd service

Files

File Purpose
/etc/compose/docker-compose.yml Compose file describing what to deploy
/etc/systemd/system/docker-compose-reload.service Executing unit to trigger reload on docker-compose.service
/etc/systemd/system/docker-compose-reload.timer Timer unit to plan the reloads
/etc/systemd/system/docker-compose.service Service unit to start and manage docker compose
#!/usr/bin/env php
<?php
function getContents($params)
{
[$self, $file, $startLine, $startColumn, $endLine, $endColumn] = $params;
--$startLine;
--$startColumn;
--$endLine;
--$endColumn;
@recca0120
recca0120 / chocolatey.cmd
Created July 29, 2020 04:50 — forked from solodyagin/chocolatey.cmd
(Chocolatey) Automatic installation script of programs
@echo off
net file 1>nul 2>nul
if "%errorlevel%" == "0" (goto admin)
:elevate
echo Set UAC = CreateObject^("Shell.Application"^) > "%Temp%\elevate.vbs"
set params = %*:"="
echo UAC.ShellExecute "cmd.exe", "/c %~s0 %params%", "", "runas", 1 >> "%Temp%\elevate.vbs"
"%Temp%\elevate.vbs"
del "%Temp%\elevate.vbs"