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 | |
# Setup Reference: https://blog.sbstp.ca/vps-pihole/ | |
# Run this script as CRON Job in your laptop or any device. | |
# Author - mcnaveen<me@mcnaveen.com> | |
ip=$(curl -s https://api.ipify.org | grep -oE '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+') | |
ip_file="ip_address.txt" | |
vps_ip="YOUR_VPS_IP_ADDRESS" | |
if [[ -f $ip_file ]]; then |
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
const { spawn } = require("child_process"); | |
const outputFile = "output.mp4"; | |
const duration = 4; // Duration in seconds | |
const inputImage = "photo.jpg"; | |
const outputDimensions = "1080:1920"; // Output video dimensions | |
const ffmpegCommand = `ffmpeg -loop 1 -t ${duration} -i ${inputImage} -i ${inputImage} -filter_complex "[0:v]scale=${outputDimensions},setsar=1:1[bg];[bg]boxblur=5:2[bg];[bg][1:v]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2" -c:v libx264 -preset superfast -pix_fmt yuv420p -t ${duration} ${outputFile}`; | |
const ffmpegProcess = spawn(ffmpegCommand, { shell: true }); |
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
name: Deploy Next.js Site via SSH | |
on: | |
push: | |
tags: | |
- "*" | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest |
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 | |
while true; do | |
# Set a random wallpaper from the specified folder | |
feh --randomize --bg-fill ~/Pictures/Wallpapers/* | |
# Get the current wallpaper from .fehbg | |
wallpaper="$(cat "${HOME}/.fehbg" | awk -F "'" '{print $2}')" | |
# Apply pywal color scheme to desktop |
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 node:16 | |
# Create app directory | |
WORKDIR /usr/src/app | |
# Copy package.json | |
COPY package*.json ./ | |
# Install dependencies | |
RUN yarn install |
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
# .github/workflows/main.yml | |
name: Trigger Netlify Build | |
on: | |
schedule: | |
# Run at 0000 daily | |
- cron: '0 0 * * *' | |
jobs: | |
build: | |
name: Request Netlify Webhook |
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
<?php | |
add_filter( 'woocommerce_available_payment_gateways', 'mcnaveen_payment_gateway_based_on_country' ); | |
function mcnaveen_payment_gateway_based_on_country( $available_gateways ) { | |
if ( is_admin() ) return $available_gateways; | |
if ( WC()->customer->get_billing_country() !== 'IN' ) { | |
unset( $available_gateways['wc-razorpay'] ); | |
} else { | |
if ( WC()->customer->get_billing_country() === 'IN' ) { | |
unset( $available_gateways['stripe'] ); |
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
<script type="text/javascript"> | |
function personalizeryInit() { | |
let params = new URL(document.location).searchParams; | |
let name = params.get("firstname"); | |
let email = params.get("email"); | |
document.querySelector("#form-field-field_8fd15b6").value = name; | |
document.querySelector("#form-field-email").value = email; | |
} | |
personalizeryInit(); | |
</script> |
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
<script type="text/javascript"> | |
function personalizeryInit() { | |
let params = new URL(document.location).searchParams; | |
let name = params.get("firstname"); | |
let email = params.get("email"); | |
document.querySelector("#form-field-name").value = name; | |
document.querySelector("#form-field-email").value = email; | |
} | |
personalizeryInit(); |
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
const storedValueAsNumber = Number(localStorage.getItem("limit")); | |
const [userLimit, setUserLimit] = useState( | |
Number.isInteger(storedValueAsNumber) ? storedValueAsNumber : 0 | |
); | |
useEffect(() => { | |
localStorage.setItem("limit", String(userLimit)); | |
}, [userLimit]); |