Skip to content

Instantly share code, notes, and snippets.

@Danetag
Danetag / useMyAwesomeHook.specs.tsx
Last active March 28, 2024 15:00
Testing a React hook with a redux store
import React from 'react';
import { renderHook } from '@testing-library/react-hooks';
import stateFactory from 'jest/stateFactory';
import configureMockStore from 'redux-mock-store';
import { Provider } from 'react-redux';
import { Store, AnyAction } from 'redux';
import { initialState as initialPaginationState } from '../../store/pagination/reducer';
import { useMyAwesomeHook } from '../useMyAwesomeHook';
@sharryy
sharryy / schema-dump.php
Created March 28, 2024 12:47
A simple laravel command to prune and squash migration using MySQL from Docker container.
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Filesystem\Filesystem;
use Symfony\Component\Process\Process;
class DockerSchemDumpCommand extends Command
{
@jjsquady
jjsquady / nextjs-deploy.md
Last active March 28, 2024 14:59
Deploying NEXTJS site with nginx + pm2

How to setup next.js app on nginx with letsencrypt

next.js, nginx, reverse-proxy, ssl

1. Install nginx and letsencrypt

$ sudo apt-get update
$ sudo apt-get install nginx letsencrypt

Also enable nginx in ufw

Direct copy of pre-encoded file:

$ ffmpeg -i filename.mp4 -codec: copy -start_number 0 -hls_time 10 -hls_list_size 0 -f hls filename.m3u8

@anamorph
anamorph / HOWTO-Lightroom_sync_with_s3-windows-macos.md
Last active March 28, 2024 14:58
HOWTO Lightroom sync with s3 windows/macos

HOWTO Lightroom sync with s3 windows/macos

1. The pitch

As I am an avid photographer & travelling quite a lot, I wanted to sync my Adobe Lightroom library from Macbook to my Microsoft Windows desktop at home with very little/no human intervention. It is also a good thing that both Lightroom versions (mac & windows) share a common file system/structure, this helped alot in synchronizing data from one environment to another.

This HOWTO assumes you already have an AWS account created and running with an IAM user configured.

Put together, the solution would look as such (pardon my poor diagram skills):

                                  _  
macbook pro                     (`  ).                     windows desktop
@OrionReed
OrionReed / DOM3D.js
Last active March 28, 2024 15:01
3D DOM viewer, copy-paste this into your console to visualise the DOM topographically.
// 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks.
// You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/)
(() => {
const SHOW_SIDES = false; // color sides of DOM nodes?
const COLOR_SURFACE = true; // color tops of DOM nodes?
const COLOR_RANDOM = false; // randomise color?
const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com)
const MAX_ROTATION = 180; // set to 360 to rotate all the way round
const THICKNESS = 20; // thickness of layers
const DISTANCE = 10000; // ¯\\_(ツ)_/¯

Beginner's Guide to Python and Prompt Engineering

This guide is designed to help beginners navigate through the essential steps and resources to build a strong foundation in both fields.

Motivation

I'm currently working as a Software Engineer, AI/MLOps. This guide addresses some of the biggest pain points that I encounter while on the learning job. The resources I wish I had discovered sooner.

Starting with Python Basics