Skip to content

Instantly share code, notes, and snippets.

View dr5hn's full-sized avatar
🪄
Turning ☕ into code | Full Stack Magician 🧙‍♂️✨

Darshan Gada dr5hn

🪄
Turning ☕ into code | Full Stack Magician 🧙‍♂️✨
View GitHub Profile
@dr5hn
dr5hn / fix-pys-deprecations.patch
Last active March 13, 2024 12:04
#[ReturnTypeWillChange] Fix Pixelyoursite Deprecation Errors PHP 8.1
diff --git a/vendor_prefix/facebook/php-business-sdk/src/FacebookAds/Object/ServerSide/Event.php b/vendor_prefix/facebook/php-business-sdk/src/FacebookAds/Object/ServerSide/Event.php
index 3373410..1c7c5f3 100644
--- a/vendor_prefix/facebook/php-business-sdk/src/FacebookAds/Object/ServerSide/Event.php
+++ b/vendor_prefix/facebook/php-business-sdk/src/FacebookAds/Object/ServerSide/Event.php
@@ -342,6 +342,7 @@ class Event implements ArrayAccess {
* @param integer $offset Offset
* @return boolean
*/
+ #[\ReturnTypeWillChange]
public function offsetExists($offset) : bool {
@dr5hn
dr5hn / Win10.preset
Created February 5, 2024 11:12 — forked from Log1x/Win10.preset
Recommended Windows 10 Performance Preset
# See: https://github.com/Disassembler0/Win10-Initial-Setup-Script
### Require administrator privileges ###
RequireAdmin
### Privacy Tweaks ###
DisableTelemetry # EnableTelemetry
DisableWiFiSense # EnableWiFiSense
DisableSmartScreen # EnableSmartScreen
DisableWebSearch # EnableWebSearch
@dr5hn
dr5hn / go.mod
Created January 24, 2024 08:43 — forked from caner-cetin/go.mod
World Data Fix Script on Golang
module cityconv
go 1.20
require github.com/jackc/pgx/v5 v5.4.1
require (
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect
golang.org/x/crypto v0.9.0 // indirect
@dr5hn
dr5hn / country-files.js
Created January 5, 2024 16:09 — forked from vis97c/country-files.js
Separate country data from dr5hn/countries-states-cities-database into smaller files
const fs = require("fs/promises");
const path = require("path");
const _ = require("lodash");
/**
* Write file
* @param {string} filePath
* @param {*} data
*/
async function writeFile(filePath, data) {
@dr5hn
dr5hn / README.md
Created March 25, 2023 14:16 — forked from VladimirAlexiev/README.md
How to use Google Sheets to Manage Wikidata Coreferencing

How to use Google Sheets to Manage Wikidata Coreferencing

A previous post How to Add Museum IDs to Wikidata explained how to use SPARQL to find missing data on Wikidata (Getty Museum IDs), how to create such values (from museum webpage URLs) and how to format them properly for QuickStatements.

Here I explain how to use Google sheets to manage a more advanced task. The sheet AAT-Wikidata matches about 3k AAT concepts to Wikipedia, WordNet30 and BabelNet (it restored an old mapping to Wordnet, retrieved it from BabelNet, mapped to Wikipedia).

  • For each row, it uses the following Google sheet formula (column C) to query the Wikipedia API and get the corresponding Wikidata ID (wikibase_item); split on two lines for readability:
=ImportXml(concat("https://en.wikipedia.o
@dr5hn
dr5hn / .zshrc
Created September 3, 2021 11:41
SSH Agent - Start & Load Profiles to zsh Terminal
SSH_ENV=$HOME/.ssh/environment
# start the ssh-agent
function start_agent {
echo "Initializing new SSH agent..."
# spawn ssh-agent
/usr/bin/ssh-agent | sed 's/^echo/#echo/' > ${SSH_ENV}
echo succeeded
chmod 600 ${SSH_ENV}
. ${SSH_ENV} > /dev/null
@dr5hn
dr5hn / .zprofile
Created September 3, 2021 11:39
Useful Aliases & .zProfile config
# Sourced upon login
eval $(/opt/homebrew/bin/brew shellenv)
# Setup Compiler paths for readline and openssl
local READLINE_PATH=$(brew --prefix readline)
local OPENSSL_PATH=$(brew --prefix openssl@1.1)
export LDFLAGS="-L$READLINE_PATH/lib -L$OPENSSL_PATH/lib"
export CPPFLAGS="-I$READLINE_PATH/include -I$OPENSSL_PATH/include"
export PKG_CONFIG_PATH="$READLINE_PATH/lib/pkgconfig:$OPENSSL_PATH/lib/pkgconfig"
@dr5hn
dr5hn / composer.sh
Created September 3, 2021 11:33
Install composer v1.x and v2.x simultaneously
#!/bin/sh
EXPECTED_CHECKSUM="$(wget -q -O - https://composer.github.io/installer.sig)"
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"
if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]
then
>&2 echo 'ERROR: Invalid installer checksum'
rm composer-setup.php
@dr5hn
dr5hn / functions.php
Created September 3, 2021 11:29
Disable Gutenberg in Wordpress
add_filter('use_block_editor_for_post_type', function($use_block_editor, $post_type){
return in_array($post_type, []);
}, 10, 2);
add_action( 'wp_enqueue_scripts', function(){
wp_dequeue_style( 'wp-block-library' );
}, 100 );
@dr5hn
dr5hn / functions.php
Created September 3, 2021 10:07
Remove default Wordpress admin dashboard widgets
/**
* Remove Unwanted Dashboard Widget
*/
function remove_dashboard_meta()
{
// remove_meta_box( 'dashboard_activity', 'dashboard', 'normal' ); // Activity
remove_meta_box('dashboard_primary', 'dashboard', 'normal'); // WordPress News
remove_meta_box('dashboard_quick_press', 'dashboard', 'side'); // Quick Draft
// remove_meta_box( 'dashboard_right_now', 'dashboard', 'normal' ); // At a Glance
remove_meta_box('dashboard_site_health', 'dashboard', 'normal'); // Site Health