This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This script will backup your Coolify instance and move everything to a new server. Docker volumes, Coolify database, and ssh keys | |
# 1. Script must run on the source server | |
# 2. Have all the containers running that you want to migrate | |
# Configuration - Modify as needed | |
sshKeyPath="$HOME/.ssh/your_private_key" # Key to destination server | |
destinationHost="server.example.com" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu:22.04 | |
ARG DEBIAN_FRONTEND=noninteractive | |
RUN apt-get update | |
RUN apt-get install -y apt-transport-https | |
RUN apt-get install -y software-properties-common | |
RUN add-apt-repository -y ppa:ondrej/php | |
RUN add-apt-repository -y ppa:ondrej/apache2 | |
RUN apt-get update |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mediaJSON = { "categories" : [ { "name" : "Movies", | |
"videos" : [ | |
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org", | |
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ], | |
"subtitle" : "By Blender Foundation", | |
"thumb" : "images/BigBuckBunny.jpg", | |
"title" : "Big Buck Bunny" | |
}, | |
{ "description" : "The first Blender Open Movie from 2006", | |
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Remove .php extension | |
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\ (.*)\.php [NC] | |
RewriteRule ^ %1 [R=301,NE,L] | |
# Check whether the file exists then set it back internally | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME}.php -f | |
RewriteRule ^.*$ $0.php [L,NE] | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The problem is that if you have video controls (progress bar, full-screen button) | |
// they will pop up when video scrolls into viewport, leading to a distracting | |
// Solution: Remove controls via JS and only add them when video is hovered | |
<script> | |
(function() { | |
var videos = document.querySelectorAll('video'); | |
var i; | |
for(i = 0; i < videos.length; ++i) { | |
(function (video) { | |
video.removeAttribute('controls'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const enum EventType { | |
INFO_UPDATED, | |
} | |
type DATA_INFO_UPDATED = string; | |
type IEventCallback<T> = (data: T) => void; | |
interface IEventSubscribers { | |
[eventType: number]: Array<IEventCallback<any>> | undefined; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inline int round_positive_float(float f) | |
{ | |
return static_cast〈int〉(f + 0.5f); | |
} | |
class ControlledRandom | |
{ | |
float state = 1.0f; | |
int index = 0; | |
static constexpr float constant_to_multiply[101] = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"React Connected Component": { | |
"prefix": "rcc", | |
"body": [ | |
"import * as React from 'react';\r", | |
"import { connect } from 'react-redux';\r", | |
"\r", | |
"interface IOwnProps {\r", | |
"\r", | |
"}\r", |