Skip to content

Instantly share code, notes, and snippets.

View espenmn's full-sized avatar

Espen Moe-Nilssen espenmn

View GitHub Profile
--change "Users:gm:Downloads: to "Users:Jan:Desktop" or similar
--folder for files must be chosen one time (?)
tell application "Finder"
global thedate
set thedate to (current date) as string
global bndItems
try
activate
@espenmn
espenmn / Change image paths to resolved images Plone.py
Last active April 11, 2023 13:33
change_to_resolved_images_clone.py
#python 3
#bin/instance run set_alt_leadimage.py
#cd /home/medialog/vol3/skipshistorie9996/zinstance/; sudo bin/instance run ../../set_resolve_images.py
from zope.lifecycleevent import modified
import plone.api
from zope.component.hooks import setSite
from plone.app.textfield import RichText
from plone.app.textfield.value import RichTextValue
from plone.rfc822.interfaces import IPrimaryFieldInfo
# bin/instance run find_macfiles.py -O skipshistorie
import plone.api
from zope.component.hooks import setSite
setSite(app['skipshistorie'])
for brain in app.skipshistorie.portal_catalog(id="ds_store"):
obj= brain.getObject()
print('deleting')
#python 3
import pandas as pd
#import openpyxl
from zope.lifecycleevent import modified
import plone.api
from zope.component.hooks import setSite
setSite(app['mysite'])
<!-- wp:shortcode -->[pods field="field1"]<!-- /wp:shortcode -->
Example 1:
// Redirect to John Doe if mail body contains 'John Doe'
add_filter('wp_mail', 'medialog_john_doe', 99);
function medialog_john_doe($args)
{
if (str_contains($args['message'], 'John Doe')) {
$args['to'] = 'john@doe.com';
return $args;
}
}
for i in */; do zip -r "${i%/}.zip" "$i"; done
#Dont need this, the zip commend does not include hidden files
for i in */; do zip -d *.zip __MACOSX/\*zip -r "${i%/}.zip" "$i"; done
@espenmn
espenmn / BBEdit-TextWrangler_RegEx_Cheat_Sheet.txt
Created February 27, 2023 12:18 — forked from ccstone/BBEdit-TextWrangler_RegEx_Cheat_Sheet.txt
BBEdit-TextWrangler Regular Expression Cheat-Sheet
————————————————————————————————————————————————————————————————————————————————————————————————————
BBEdit / BBEdit-Lite / TextWrangler Regular Expression Guide Modified: 2018/08/10 01:19
————————————————————————————————————————————————————————————————————————————————————————————————————
NOTES:
The PCRE engine (Perl Compatible Regular Expressions) is what BBEdit and TextWrangler use.
Items I'm unsure of are marked '# PCRE?'. The list while fairly comprehensive is not complete.
ssh -L 61000:localhost:5901 -N -l navn servername.local