Skip to content

Instantly share code, notes, and snippets.

View dossy's full-sized avatar
🍪
derping around

Dossy Shiobara dossy

🍪
derping around
View GitHub Profile
@aegrumet
aegrumet / decrypt-nextauth-jwe.go
Created December 4, 2022 01:24
Decrypt a NextAuth jwe from somewhere else
package main
import (
"crypto/sha256"
"fmt"
"io"
"github.com/lestrrat-go/jwx/v2/jwa"
"github.com/lestrrat-go/jwx/v2/jwe"
"golang.org/x/crypto/hkdf"
@cobaltapps
cobaltapps / genesis-page-builder-page-styles.css
Last active June 9, 2022 07:35
Styles for Genesis Theme pages when using a Page Builder Plugin.
.builder-page .site-inner {
max-width: 100%;
padding: 0;
}
.builder-page .content {
width: 100%;
}
.builder-page .entry {
margin-bottom: 0;
}
@fntlnz
fntlnz / self-signed-certificate-with-custom-ca.md
Last active May 6, 2024 08:45
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
@steipete
steipete / ios-xcode-device-support.sh
Last active December 12, 2023 03:36
Using iOS 15 devices with Xcode 12.5 (instead of Xcode 13)
# The trick is to link the DeviceSupport folder from the beta to the stable version.
# sudo needed if you run the Mac App Store version. Always download the dmg instead... you'll thank me later :)
# Support iOS 15 devices (Xcode 13.0) with Xcode 12.5:
sudo ln -s /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/15.0 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport
# Then restart Xcode and reconnect your devices. You will need to do that for every beta of future iOS versions
# (A similar approach works for older versions too, just change the version number after DeviceSupport)
@dossy
dossy / patch_inotify_init1.c
Created November 27, 2015 18:43
Running CrashPlan on older Linux
/*
* $ gcc -Wall -shared -fPIC -o patch_inotify_init1.so patch_inotify_init1.c
*
* LD_PRELOAD=patch_inotify_init1.so java ...
*
* [11.27.15 12:43:37.040 ERROR main .service.backup.BackupController] Exception setting up BackupController! , java.lang.UnsatisfiedLinkError: Error looking up function 'inotify_init1': /usr/local/crashplan/jre/bin/java: undefined symbol: inotify_init1
* STACKTRACE:: java.lang.UnsatisfiedLinkError: Error looking up function 'inotify_init1': /usr/local/crashplan/jre/bin/java: undefined symbol: inotify_init1
* at com.sun.jna.Function.<init>(Function.java:208)
* at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:536)
* at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:513)
@nickcernis
nickcernis / mailchimp-popup-for-wordpress.md
Last active July 28, 2022 14:49
MailChimp Popup Script that works with WordPress sites

MailChimp's default popup scripts can break on WordPress sites that use jQuery/jQuery UI unless you include their embed code as the final elements before the closing body tag.

Including them in this way isn't always possible or easy with WordPress.

The code below is an alternative implementation of the loader that forces MailChimp's popup scripts to appear below all other scripts upon page load.

To use it, modify the baseUrl, uuid, and lid attributes with the ones from the original popup script that MailChimp supplies.

@rveitch
rveitch / wordPress_table_pagination_example.php
Created July 30, 2015 01:44
WordPress Table Pagination Example
<?php
global $wpdb;
$pagenum = isset( $_GET['pagenum'] ) ? absint( $_GET['pagenum'] ) : 1;
$limit = 5;
$offset = ( $pagenum - 1 ) * $limit;
$entries = $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}posts LIMIT $offset, $limit" );
echo '<div class="wrap">';
@jtsternberg
jtsternberg / db.php
Last active October 20, 2022 19:12
Simplified WordPress DB drop-in replacement for persistent database connections
<?php
/**
* Simplified WordPress DB drop-in replacement for persistent database connections
* (If https://core.trac.wordpress.org/attachment/ticket/31018/31018-2.diff gets into core)
*
* Actual working version right now would look like: https://gist.github.com/jtsternberg/eec4ab95e11ce9be4807
*
* WordPress Trac Ticket {@link https://core.trac.wordpress.org/ticket/31018}
*/
@dossy
dossy / screencapture.sh
Created November 25, 2014 15:22
Capture screen and convert to 16 color grayscale on OSX
# Because I know I'll forget this when I need it again, I'm documenting it here.
screencapture -x -C -T0 cap.png; (pngtopnm cap.png | ppmtopgm | pnmquant 16 | pnmtopng > cap-bw.png) >/dev/null 2>&1