Skip to content

Instantly share code, notes, and snippets.

View huksley's full-sized avatar
🐈
Step on no pets

Ruslan Gainutdinov huksley

🐈
Step on no pets
View GitHub Profile
@huksley
huksley / Dockerfile
Created February 14, 2024 19:05
Simple PHP dokku application with a custom Docker container
FROM php:8.2-apache
RUN apt-get update && apt-get install -y \
libfreetype-dev \
libjpeg62-turbo-dev \
libpng-dev \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install -j$(nproc) gd
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
@huksley
huksley / day-night-lighthouse-illustration-css.markdown
Created January 29, 2024 20:04
Day/Night Lighthouse Illustration - CSS
@huksley
huksley / clean-table-and-load-dishwasher.json
Created December 13, 2023 11:09
clean-table-and-load-dishwasher.json
[
{
"action": "order",
"team": "bussers",
"description": "Clear all dirty plates, glasses, and utensils from tables and take to the kitchen"
},
{
"action": "ask",
"team": "servers",
"description": "Assist bussers in clearing tables if needed"
@huksley
huksley / .github-workflows-push.yml
Created September 18, 2023 06:53
Github Actions to deploy to privately hosted dokku
---
name: 'deploy'
on:
push:
branches:
- master
jobs:
deploy:
@huksley
huksley / AgTable.stories.tsx
Created August 27, 2023 19:00
Example of AgGrid usage - storybook showcase
import React, { useMemo, useState } from "react";
import { Meta } from "@storybook/react";
import { AgGridReact } from "ag-grid-react";
import { ColDef } from "ag-grid-community";
import "ag-grid-community/styles/ag-grid.css";
import "ag-grid-community/styles/ag-theme-alpine.css";
export default {
title: __filename.replace(".stories.tsx", "")
@huksley
huksley / chatgptblinking.html
Created June 8, 2023 10:26
Text typing with cursor blinkin
<div id="typewriter">
<span id="typewriter-text"></span><span class="blinking-cursor">|</span>
</div>
<script src="https://cdn.twind.style" crossorigin></script>
<script>
function type(index, text) {
const typewriter = document.getElementById('typewriter-text');
if (index < text.length) {
typewriter.__run = () => type(index + 1, text)
typewriter.innerHTML = text.slice(0, index);
@huksley
huksley / mrsk-accessory-docker-registry.yml
Last active August 13, 2023 10:56
Run docker registry as mrsk accessory
registry-github: &docker
username: username
password:
- DOCKER_TOKEN
registry-internal: &internal
server: registry.example.com
username: testuser
password: testpassword123
# This uses YAML magic and Ruby template language to select registry on the fly
registry: *<%= ENV["MRSK_REGISTRY"] || 'internal' %>
@huksley
huksley / mrsk.md
Last active January 12, 2024 17:24
mrsk - the missing manual

MRSK

This documentation adds important additions to the docs for mrsk deploy tool (see github.com/mrsked/mrsk)

Destination flag

You can use mrsk deploy --destination staging

This will read config/deploy.yml and config/deploy.staging.yml files, and also will read .env.staging file if it exists.

@huksley
huksley / ws.ts
Created April 18, 2023 07:31
NextJS websocket API route
import { Server } from "http";
import { Socket } from "net";
import { NextApiRequest, NextApiResponse } from "next";
import { Server as SocketServer } from "socket.io";
interface NextSocket extends Socket {
server?: Server & { io?: SocketServer };
}
/**
@huksley
huksley / api-video.ts
Created April 13, 2023 17:45
NextJS function to serve video file with ranges
import type { NextApiRequest, NextApiResponse } from "next";
import * as fs from "fs";
const filePath = "video.mp4";
export default function serveByteRanges(req: NextApiRequest, res: NextApiResponse) {
// Listing 3.
const options = {
start: undefined as undefined | number,
end: undefined as undefined | number,