Skip to content

Instantly share code, notes, and snippets.

View Firsh's full-sized avatar

Firsh Firsh

View GitHub Profile
@Firsh
Firsh / lwp-cloudflare-dyndns.sh
Last active April 23, 2025 15:56
Cloudflare as Dynamic DNS
#!/bin/bash
# Cloudflare as Dynamic DNS
# From: https://letswp.io/cloudflare-as-dynamic-dns-raspberry-pi/
# Based on: https://gist.github.com/benkulbertis/fff10759c2391b6618dd/
# Original non-RPi article: https://phillymesh.net/2016/02/23/setting-up-dynamic-dns-for-your-registered-domain-through-cloudflare/
# Update these with real values
auth_email="[email protected]"
auth_key="global_api_key_goes_here"
zone_name="example.com"
@Firsh
Firsh / code.gs
Created October 30, 2018 10:12
Ez kell az IMPORTJSON-hoz
/**
* @OnlyCurrentDoc
*/
//Global Variables
var currSpreadsheet=SpreadsheetApp.getActiveSpreadsheet();// get current spreadsheet
var shtPortfolioSummary = currSpreadsheet.getSheetByName('Portfolio Summary');
var shtPortfolioHistory = currSpreadsheet.getSheetByName('Portfolio History');
var shtYahooDataRef = currSpreadsheet.getSheetByName('Yahoo Data Ref');
var shtYahooDataRefUSD = currSpreadsheet.getSheetByName('Yahoo Data Ref USD');
@Firsh
Firsh / custom.js
Created December 23, 2018 12:54
Copyright Copy Paste
function addLink() {
var content_element = document.getElementById('wtr-content');
var body_element = document.getElementsByTagName("body")[0]
var selection, newdiv;
if (window.getSelection) {
selection = window.getSelection();
}else{
var ypos = jQuery(document).scrollTop()
selection = readSelected(content_element)
jQuery(document).scrollTop(ypos)
@Firsh
Firsh / install-vivaldi-custom-css.bat
Last active July 19, 2025 22:11
Install Vivaldi Custom CSS
@set installhooks_args=%*& set installhooks_self=%~f0& powershell -c "(gc \"%~f0\") -replace '@set installhooks_args.*','#' | Write-Host" | powershell -c -& goto :eof
$srcdir = split-path $env:installhooks_self
$vivpath = "c:\Program Files\Vivaldi\Application\"
Try {
$dstdir = split-path ((Get-ChildItem -path $vivpath -recurse browser.html | Sort-Object -property CreationTime -descending | Select-Object -first 1).FullName)
write-host "Destination directory: $dstdir"
$encoding = (New-Object System.Text.UTF8Encoding($False))
@Firsh
Firsh / functions.php
Last active December 15, 2020 11:13
JIG galleries by custom meta
<?php
//The new filters are called 'jig_media_library_query_args' and 'jig_recent_posts_query_args'
// Media Library queries
add_filter('jig_media_library_query_args', 'jig_change_media_library_query', 10, 2);
function jig_change_media_library_query ($args, $atts) {
$args['meta_key'] = 'your_custom_field_name'; // some start with an underscore
$args['meta_value'] = 'field_value';
return $args;
}
@Firsh
Firsh / symptoms.md
Created June 10, 2021 10:44
Upswing and downswing symptoms from Howard Marks, Mastering the Market Cycle

The following progression serves to sum up regarding the upswing of the market cycle. It shows how cycles in economics, profits, psychology, risk aversion and media behavior combine to move market prices well beyond intrinsic value, and how one development contributes to the next.

  • The economy is growing, and the economic reports are positive.
  • Corporate earnings are rising and beating expectations.
  • The media carry only good news.
  • Securities markets strengthen.
  • Investors grow increasingly confident and optimistic.
  • Risk is perceived as being scarce and benign.
  • Investors think of risk-bearing as a sure route to profit.
  • Greed motivates behavior.
@Firsh
Firsh / functions.php
Last active January 1, 2022 17:50
JIG show (custom) taxonomy terms as image title
<?php
add_filter('jig_images', 'change_jig_captions', 10, 2);
function change_jig_captions($images, $atts)
{
foreach ($images as &$image) {
if (empty($image['extra_class']) || strpos($image['extra_class'], 'jig-contentID-ML-') === false) {
break;
}
if (preg_match('/(\d)+/i', $image['extra_class'], $regs)) {
@Firsh
Firsh / functions.php
Last active January 4, 2022 22:25
PhotoSwipe HTML
<?php
function photoswipe_html() {
global $post;
if ($post->ID !== 21801) {
return;
}
echo <<<'EOD'
<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">
<div class="pswp__bg"></div>
@Firsh
Firsh / functions.php
Last active November 16, 2022 09:00
Custom image sizes and unregistering unused ones for WordPress
<?php
// This removes the hard limit and oprhan originals
add_filter('big_image_size_threshold', '__return_false');
// This is pretty nice custom skipper
add_filter('intermediate_image_sizes_advanced', 'remove_default_images');
function remove_default_images($sizes)
{
//unset($sizes['small']); // 150px
//unset($sizes['medium']); // 300px
unset($sizes['large']);
@Firsh
Firsh / webp-test.xml
Created March 3, 2022 15:25
RSS-based WebP test for Tim Morozzo
<?xml version="1.0" ?>
<rss version="2.0">
<channel>
<title>WEBP in JPG Tim Morozzo test feed</title>
<description>To make TimThumb recognize these are webp</description>
<link>https://justifiedgrid.com/</link>
<item>
<title>project for UWS Alumni</title>
<description><![CDATA[
<img src="https://www.morozzo.co.uk/wp-content/uploads/2017/01/DSC_2591-bw-1.jpg" />