Skip to content

Instantly share code, notes, and snippets.

View Cristy94's full-sized avatar
🏓
<3 Table tennis!

Buleandra Cristian Cristy94

🏓
<3 Table tennis!
View GitHub Profile
@Cristy94
Cristy94 / migrate.sh
Created September 4, 2024 01:08 — forked from Geczy/migrate.sh
Migrate Coolify to a new server
#!/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"
@Cristy94
Cristy94 / gist:33cea401d1b6970ed2f0900d57088986
Created August 25, 2024 02:24
Dockerfile for LAMP container - MariaDB PHP 8 Ubuntu 22.04
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
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" ],
# 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]
@Cristy94
Cristy94 / video-scroll-fix.js
Created March 25, 2021 19:56
Fix browser HTML5 video controls showing up while scrolling
// 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');
@Cristy94
Cristy94 / EventSystem.ts
Created January 15, 2020 23:48
TypeScript simple global Event System
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;
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] =
@Cristy94
Cristy94 / react-vscode-snippets.json
Created April 2, 2018 11:40
React Typescript VSCode snippets for quickly creating components (use shorthand 'rc' or 'rcc')
{
"React Connected Component": {
"prefix": "rcc",
"body": [
"import * as React from 'react';\r",
"import { connect } from 'react-redux';\r",
"\r",
"interface IOwnProps {\r",
"\r",
"}\r",