Skip to content

Instantly share code, notes, and snippets.

View arbitrarily's full-sized avatar

Marko Bajlovic arbitrarily

View GitHub Profile
@leophys
leophys / godoc.zsh
Last active August 28, 2023 05:16
Optionally colored and fuzzy findable godoc
### colored and fuzzy go doc
if which bat > /dev/null; then
function _godoc() {
if echo $1|grep -q -E "^([a-zA-Z0-9/]+)$"; then
go doc ${@} | bat -p -l md
elif echo $1|grep -q -E "^[a-zA-Z0-9/]+\.[a-zA-Z0-9.]+$"; then
go doc ${@} | bat -p -l go
elif echo $1|grep -q -E "^([a-zA-Z0-9/._-]+)/.*\.[a-zA-Z0-9.]+$"; then
go doc ${@} | bat -p -l go
else
@jerome-rdlv
jerome-rdlv / feed-thumbnail.php
Last active December 6, 2022 19:36
WordPress RSS feed post thumbnail for MailChimp
<?php
/**
* This file can be dropped in wp-content/mu-plugins/ to be activated.
* It will add post thumbnails to the RSS feed.
* The image can then be used in MailChimp templates with the *|RSSITEM:IMAGE|* merge tag.
* This implementation is based on useful indications by [vick](https://stackoverflow.com/a/48549541)
*/
// add xml namespace for media element
import requests
import base64
import random
import urllib.request
def download_image(url):
name = random.randrange(10000000, 100000000)
fullname = str(name) + ".jpg"
urllib.request.urlretrieve(url, fullname)
@aelk00
aelk00 / remove-likes.md
Last active March 1, 2024 00:58
Remove all your facebook likes
@prasidhda
prasidhda / common spam words 2020
Last active June 21, 2023 13:17
List of common spam words
0%
0% risk
777
99%
99.9%
100%
100% more
#1
$$$
100% free
@openroomxyz
openroomxyz / WordpressAPI_UploadImage.py
Last active August 16, 2023 00:17
Python WordPress API : How to upload image to wordpress?
import base64, requests, json
def header(user, password):
credentials = user + ':' + password
token = base64.b64encode(credentials.encode())
header_json = {'Authorization': 'Basic ' + token.decode('utf-8')}
return header_json
def upload_image_to_wordpress(file_path, url, header_json):
media = {'file': open(file_path,"rb"),'caption': 'My great demo picture'}
@nfsarmento
nfsarmento / nginx-wordpress.conf
Last active March 7, 2024 13:38
Harden wordpress security nginx
############ WordPress ####################
# Disable logging for favicon and robots.txt
location = /favicon.ico {
try_files /favicon.ico @empty;
access_log off;
log_not_found off;
expires max;
}
@evanfraser
evanfraser / gravity-forms-button.php
Last active July 13, 2022 17:21
Change Gravity Forms submit input to a button element
<?php
function form_submit_button ($button, $form) {
$button = str_replace("input", "button", $button);
$button = str_replace("/", "", $button);
$button .= "{$form['button']['text']}</button>";
return $button;
}
add_filter('gform_submit_button', 'form_submit_button', 10, 5);
@SeppoTakalo
SeppoTakalo / Tune Mac OS X terminal.md
Last active November 20, 2023 21:38
Tune Mac OS X terminal

This page lists my personal preferences to set up proper command line for Mac OS X.

Change default shell to ZSH

Current default for Mac OS X Catalina, offers much better customizations that Bash.

chsh -s /bin/zsh

Install Homebrew

@dexit
dexit / api.php
Created May 3, 2019 17:32
Disable WordPress REST API endpoints
// Remove init rest routes
remove_action( 'rest_api_init', 'create_initial_rest_routes', 0 );
// Remove oembed rest routes
function remove_json_api () {
// Remove the REST API lines from the HTML Header
remove_action( 'wp_head', 'rest_output_link_wp_head', 10 );
remove_action( 'wp_head', 'wp_oembed_add_discovery_links', 10 );