Skip to content

Instantly share code, notes, and snippets.

@adtac
adtac / Dockerfile
Last active April 13, 2024 22:33
#!/usr/bin/env docker run
#!/usr/bin/env -S bash -c "docker run -p 8080:8080 -it --rm \$(docker build --progress plain -f \$0 . 2>&1 | tee /dev/stderr | grep -oP 'sha256:[0-9a-f]*')"
# syntax = docker/dockerfile:1.4.0
FROM node:20
WORKDIR /root
RUN npm install sqlite3
@appsmatics
appsmatics / gt.sh
Last active January 10, 2024 19:32
Gnome Terminal History
#!/usr/bin/bash
# Start a gnome-terminal with a named history file
# Keeps a separate history for each terminal session in a $HOME/history/ folder
# HISTCONTROL=erasedups:ignoreboth ensures only unique entries
# Tested with Ubuntu 20 and 22 only!
# To sync to another machine, cp the .history/ folder across :)
# pass the terminal name as arg to this script
# usage gt.sh myproj1-server | myproj1-adminui | myproj2-dbadmin | misc | junk1
@jooray
jooray / yt-whisper
Created February 5, 2023 21:09
A script to download an audio from a video from a streaming platform such as youtube and transcribe it to text using whisper.cpp
#!/bin/bash
# Usage: yt-whisper URL [OUTPUT_FILENAME_TEMPLATE [LANGUAGE]]
# If OUTPUT_FILENAME_TEMPLATE is empty, output is yt-whisper-video
# If LANGAUGE is empty, it is set to "auto"
# General settings (paths) for whisper.cpp
# Note - this uses whisper.cpp, not official whisper. Get it at
# https://github.com/ggerganov/whisper.cpp
# You will have to adjust these
@Raistlfiren
Raistlfiren / Dockerfile
Last active August 14, 2023 19:02
XDebug 3 and Docker Reference
FROM php:7.4-cli-alpine
# Install xdebug
RUN apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS \
&& pecl install xdebug \
&& docker-php-ext-enable xdebug \
&& apk del .phpize-deps
WORKDIR /var/www/html
@tdcosta100
tdcosta100 / WSL2GUIXvnc-en.md
Last active April 27, 2024 08:11
A tutorial to use GUI in WSL2 replacing original XServer by Xvnc, allowing WSL to work like native Linux, including login screen

WSL2 with GUI using Xvnc

In this tutorial, we will setup GUI in WSL2, and access it using VNC. No additional software outside WSL (like VcXsrv) is required, except, of course, a VNC Viewer (RealVNC, TightVNC, TigerVNC, UVNC, etc, all of them might work flawlessly).

The key component we need to install is tigervnc-standalone-server.

For this setup, I will use Ubuntu 20.04 LTS (Focal Fossa, unfortunately 22.04 does not work), and install GNOME Desktop. Since the key components aren't bound to Ubuntu or GNOME, you can use your favorite distro and GUI. Check the Sample screenshots section for examples.

So let's go. First, we need a working WSL2 installation.

@Ocramius
Ocramius / Caddyfile
Last active March 11, 2024 22:14
Example docker + docker-compose + caddy + traefik setup that routes to multiple apps from one exposed HTTP port
:80 {
root /serve
}
@polaskj
polaskj / deploy.sh
Last active October 27, 2022 10:20 — forked from dfetterman/lambda_function-ECS-cloudwatch-slack.py
Lambda function that takes ECS Cloudwatch events and sends a notification to Slack
#!/bin/bash
# deploy serverless stack
serverless deploy \
--stage "dev" \
--region "us-east-1" \
--service-name "my-service-name" \
--slack-channel "#slack-alerts-example" \
--webhook-url "https://hooks.slack.com/services/12345/12345/abcdefg" \
--ecs-cluster-arn "arn:aws:ecs:us-east-1:123456:cluster/test-cluster"
@davidkudera
davidkudera / PrecompileLatteCommand.php
Created February 15, 2018 16:32
PrecompileLatteCommand
<?php
declare(strict_types=1);
namespace App\Commands\Cache;
use Nette\Application\UI\ITemplateFactory;
use Nette\Utils\FileSystem;
use Nette\Utils\Finder;
use Symfony\Component\Console\Command\Command;
@milo
milo / vhost.conf
Created November 22, 2017 11:26
Apache proxy to localhost port with WebSockets
#
# Proxy for local running .NET application on port 5000
#
# a2enmod proxy proxy_http proxy_wstunnel
#
<VirtualHost *:443>
ServerName example.com
ServerAdmin webmaster@example.com
@mortenson
mortenson / composelist.sh
Last active November 5, 2023 13:38
List all Docker Compose projects currently running
#!/bin/bash
docker ps --filter "label=com.docker.compose.project" -q | xargs docker inspect --format='{{index .Config.Labels "com.docker.compose.project"}}'| sort | uniq