Skip to content

Instantly share code, notes, and snippets.

@BenSampo
BenSampo / deploy.sh
Last active April 30, 2024 03:41
Laravel deploy script
# Change to the project directory
cd $FORGE_SITE_PATH
# Turn on maintenance mode
php artisan down || true
# Pull the latest changes from the git repository
# git reset --hard
# git clean -df
git pull origin $FORGE_SITE_BRANCH
@Ryanb58
Ryanb58 / install.md
Last active April 30, 2024 03:04
How to install telnet into a alpine docker container. This is useful when using the celery remote debugger in a dev environment.
>>> docker exec -it CONTAINERID /bin/sh
/app # telnet
/bin/sh: telnet: not found

/app # apk update
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/community/x86_64/APKINDEX.tar.gz
v3.7.0-243-gf26e75a186 [http://dl-cdn.alpinelinux.org/alpine/v3.7/main]
v3.7.0-229-g087f28e29d [http://dl-cdn.alpinelinux.org/alpine/v3.7/community]
@michaelbutler
michaelbutler / Steam_Proton_Exe.md
Last active April 24, 2024 06:49
How to run another .exe in an existing proton wine prefix

Running games through Steam's Proton is great. But what if there is a secondary exe or configuration application bundled with the game? How can you launch it if Steam itself only launches the game?

Simply run this command in a terminal:

cd /path/to/steam/steamapps/compatdata/20920/pfx

STEAM_COMPAT_DATA_PATH="/path/to/steam/steamapps/compatdata/20920" WINEPREFIX=$PWD \
    "$HOME/.steam/root/steamapps/common/Proton 5.0/proton" run ./drive_c/path/to/custom_application.exe
@Geczy
Geczy / migrate.sh
Last active April 24, 2024 06:41
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"
@lucianghinda
lucianghinda / api_response.rb
Created March 30, 2024 18:16
Mastodon Client
module Mastodon
ApiResponse = Data.define(:body, :headers, :code, :links)
end
@jonathanmoore
jonathanmoore / gist:2640302
Created May 8, 2012 23:17
Get the share counts from various APIs

Share Counts

I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.

If you want to roll up all of these into a single jQuery plugin check out Sharrre

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.

Twitter

@chrisjp
chrisjp / cloudflare_restore_ips.sh
Created October 13, 2023 15:59
A shell script to restore original visitor IPs to Apache/Nginx web servers behind Cloudflare's reverse proxy
#!/bin/bash
# Restore original visitor IPs to your logs
# https://developers.cloudflare.com/support/troubleshooting/restoring-visitor-ips/restoring-original-visitor-ips/
# Conf file locations
CLOUDFLARE_NGINX="/etc/nginx/conf.d/real_ip.conf"
CLOUDFLARE_APACHE="/etc/apache2/conf-available/remoteip.conf"
# Download IP lists (txt files)
IPV4=`curl -s -L https://www.cloudflare.com/ips-v4`
@tsabat
tsabat / zsh.md
Last active December 25, 2023 19:16
Getting oh-my-zsh to work in Ubuntu
@Efreak
Efreak / Calibre Server with nginx WebDAV.md
Last active December 2, 2022 20:40 — forked from luzfcb/CalibreServerOnLinux.md
Calibre Server on Linux (in progress)

This is for setting up an nginx virtual host with webdav access, as well as open directory access if you've got a reader that doesn't support OPDS, or as a backup in the case your server is misconfigured, inaccessible, javascript is disabled, etc.

setup an htpasswd file (this will only be used for webdav, not for calibre itself). You may run this command as many times as you like to add extra users.

mkdir -p /etc/nginx/auth
printf "$(please enter your username):$(openssl passwd $(read -p "Please enter your password")\n" >> /etc/nginx/auth/calibre-webdav-users.passwd

Use this config instead of the one in the main file

@shizhua
shizhua / category_add_form_fields.php
Last active July 19, 2022 03:23
Add custom field to Category and taxonomies
<?php
// Add the field to the Add New Category page
add_action( 'category_add_form_fields', 'pt_taxonomy_add_new_meta_field', 10, 2 );
function pt_taxonomy_add_new_meta_field() {
// this will add the custom meta field to the add new term page
?>
<div class="form-field">
<label for="term_meta[cat_icon]"><?php _e( 'Font Awesome Icons', 'pt' ); ?></label>
<input type="text" name="term_meta[cat_icon]" id="term_meta[cat_icon]" value="">