Skip to content

Instantly share code, notes, and snippets.

View mcnaveen's full-sized avatar
🦄

Naveen MC mcnaveen

🦄
View GitHub Profile
@mskian
mskian / active.php
Last active June 5, 2023 10:07
Umami API PHP proxy
<?php
header('X-Frame-Options: DENY');
header('X-XSS-Protection: 1; mode=block');
header('X-Content-Type-Options: nosniff');
header('Strict-Transport-Security: max-age=63072000');
header('Content-type:application/json; charset=utf-8');
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET,POST');
header('Access-Control-Allow-Headers: Access-Control-Allow-Headers,Content-Type,Access-Control-Allow-Methods, Authorization, X-Requested-With');
@mskian
mskian / pihole.php
Last active June 1, 2023 05:15
Pihole API Proxy using PHP cURL for Fetching ads Data
<?php
header('X-Frame-Options: DENY');
header('X-XSS-Protection: 1; mode=block');
header('X-Content-Type-Options: nosniff');
header('Strict-Transport-Security: max-age=63072000');
header('Content-type:application/json; charset=utf-8');
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET');
header('Access-Control-Allow-Headers: X-Requested-With');
@mskian
mskian / .env
Last active May 21, 2023 11:55
Pi-hole - A Simple Bash Script to Update the Home/ISP ip address in UFW Firewall to access port 53
VPSIP=XXX.XX.XX.X
PASSWORD='SERVERPASSWORD'
@liyasthomas
liyasthomas / GitHub stats count Scriptable widget script.md
Last active January 18, 2024 06:36
GitHub stats count Scriptable widget script

To use this script, simply replace the USERNAME, REPOSITORY, GITHUB_STARS_REPO and GITHUB_DOWNLOADS_REPO placeholders with the appropriate values for the GitHub repository you want to fetch the star and release download count for. Then, copy the complete script into a new Scriptable App script and run it. The star and release download count for the specified repository will be displayed in a Scriptable widget.

// Constants for widget configuration
const WIDGET_TITLE = "GitHub";
const USERNAME = "hoppscotch"
const REPOSITORY = "hoppscotch"
const GITHUB_STARS_REPO = "hoppscotch/hoppscotch";
const GITHUB_DOWNLOADS_REPO = "hoppscotch/releases";
const CACHED_DATA_HOURS = 0.5;
@mskian
mskian / umami.php
Last active January 29, 2023 16:34
Umami Wordpress - Add Umami Analytics Code in Wordpress Site - Add this below Code in your Site Specific Plugin or Themes Functions File.
function umami_preconnect_url(){
if(! is_user_logged_in()){
echo '<link rel="preconnect" href="https://umami.example.com" />';
}
}
add_action('wp_head', 'umami_preconnect_url');
function umami_track_code() {
if(! is_user_logged_in()){
?>
@vyspiansky
vyspiansky / set-default-category-for-custom-post-type.php
Created September 20, 2021 14:19
WordPress: how to set a default category for a custom post type
<?php
add_action('save_post', function($post_id, $post) {
$custom_post_type = 'custom-post-type';
$custom_taxonomy = 'custom-taxonomy';
$default_term_slug = 'default-term-slug';
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return;
// If this is just a revision, don't set default category
@zthxxx
zthxxx / Activate Office 2019 for macOS VoL.md
Last active November 18, 2024 21:25
crack activate Office on mac with license file
@xlplugins
xlplugins / xlwcty_add_custom_action_thankyou.php
Last active September 28, 2020 20:35
Add custom javascripts or php action on WooCommerce Thank you page after order completes
<?php
/**
* This is a PHP code, so should be wrapped inside PHP
* Like we added here.
* If PHP is already open then don't include above <?php open tag
*/
/**
* Adding custom javascripts or php action on WooCommerce Thank you page
* Works with WooCommerce 3.0 or above
*/