Skip to content

Instantly share code, notes, and snippets.

@CarterZhou
CarterZhou / pipeline-of-installing-and-testing-laravel-application
Last active March 28, 2024 17:05
This is a sample script of installing and testing a Laravel application using Jenkins pipeline
node {
stage('download') {
git branch: 'master', url: 'github/url/to/your/project'
}
stage('install') {
sh 'composer install'
}
stage('init') {
sh 'cp .env.example .env'
sh 'php artisan key:generate'
@wpsunshine
wpsunshine / gf-enhanced-ui-list-select.js
Last active March 28, 2024 17:03
Gravity Forms use enhanced UI on select drop down for lists
<script>
// For standard forms
jQuery( document ).on( 'gform_post_render', function( event, form_id, current_page ){
gformInitChosenFields( '#field_12_10 select', 'No results matched' ); // Change selector to #field_FORMID_FIELDID
});
// Forms that use multiple pages and ajax
jQuery( document ).on( 'gform_page_loaded', function( event, form_id, current_page ){
gformInitChosenFields( '#field_12_10 select', 'No results matched' ); // Change selector to #field_FORMID_FIELDID
});
</script>
@morningreis
morningreis / proton_opn_wg.md
Created December 16, 2022 21:26
OPNsense + ProtonVPN + Wireguard Configuration Guide

OPNsense + ProtonVPN + Wireguard

Published: 16 December 2022

Reference: https://docs.opnsense.org/manual/how-tos/wireguard-selective-routing.html

Goal: Set up one or more Wireguard connections from ProtonVPN on OPNsense, with policy based routing, and optional Killswitch.

I'm writing this guide first as a reference for my future self for when I inevitably forget how to do this, but also to help others out. I found there were not many guides on this specific configuration, particularly not with multiple concurrent connections, and these were some steps which were not at all obvious. I did begin with the guide in the official OPNsense documentation, but even that was missing info to make ProtonVPN work. If you are a pfSense user, it is very similar to OPNsense, and you should be able to follow along with some success, but I have not tested it myself.

@josemmo
josemmo / repair-mysql-data.ps1
Created August 28, 2020 18:48
Repair MySQL data directory (for XAMPP)
# Based on this answer: https://stackoverflow.com/a/61859561/1956278
# Backup old data
Rename-Item -Path "./data" -NewName "./data_old"
# Create new data directory
Copy-Item -Path "./backup" -Destination "./data" -Recurse
Remove-Item "./data/test" -Recurse
$dbPaths = Get-ChildItem -Path "./data_old" -Exclude ('mysql', 'performance_schema', 'phpmyadmin') -Recurse -Directory
Copy-Item -Path $dbPaths.FullName -Destination "./data" -Recurse
@joeschoe
joeschoe / next-firebase-image-upoad.ts
Last active March 28, 2024 17:00
Upload images to firebase storage with next app router, server components, and server actions
// Use next app router, server components, and server actions to upload files to firebase storage
//
// you probably dont want to do this since just storing images in the next public folder is usually best
// but if for some reason you need to upload files to firebase storage from nextjs, here you go
// also worth noting that the firebase-admin storage sdk has almost no documentation
// and from what I can tell does almost nothing, but it's just a wrapper around the google cloud storage sdk
// so you can use that instead if you want better documentation and functionality
import { Readable } from "stream";
import { getDownloadURL } from "firebase-admin/storage";
@Stanback
Stanback / nginx.conf
Last active March 28, 2024 16:57 — forked from michiel/cors-nginx.conf
Example Nginx configuration for adding cross-origin resource sharing (CORS) support to reverse proxied APIs
#
# CORS header support
#
# One way to use this is by placing it into a file called "cors_support"
# under your Nginx configuration directory and placing the following
# statement inside your **location** block(s):
#
# include cors_support;
#
# As of Nginx 1.7.5, add_header supports an "always" parameter which
@OrionReed
OrionReed / DOM3D.js
Last active March 28, 2024 16:53
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; // ¯\\_(ツ)_/¯
@artyom
artyom / chat.go
Created March 12, 2016 22:06
Example of interactive terminal in Go
package main
import (
"fmt"
"io"
"log"
"os"
"golang.org/x/crypto/ssh/terminal"
)
c:\gbdk\bin\lcc -Wa-l -Wl-m -Wl-j -DUSE_SFR_FOR_REG -c -o main.o main.c
c:\gbdk\bin\lcc -Wa-l -Wl-m -Wl-j -DUSE_SFR_FOR_REG -o main.gb main.o
@SoNothingMC
SoNothingMC / CiderAudio.md
Last active March 28, 2024 16:50
The Complete Guide to Cider Audio Lab

The Complete Guide to Cider Audio Lab

(aka Audio Lab descriptions without the jargon)

Have you wondered just what the f**k do those Cider Audio Lab descriptions mean?
Well, let me break it down for you.


What even is Audio Lab?

Cider Audio Lab is a suite of audio enhancement options that make your music sound better.