Skip to content

Instantly share code, notes, and snippets.

View mrjcleaver's full-sized avatar

Martin Cleaver mrjcleaver

View GitHub Profile
@ThinkSalat
ThinkSalat / Readwise to Raindrop.js
Last active October 31, 2023 20:11
Syncs your Readwise documents, highlights and annotations to Raindrop. automatically adds new highlights and annotations. Set up the config using the tokens from readwise and raindrop, and leave LASTUPDATE blank as it will gather all your documents and add them to the raindrop collection on the first run. Find RAINDROPCOLLECTIONID using this htt…
const fs = require('fs');
const path = require('path');
const filePath = path.join(__dirname, 'config.txt');
const logFilePath = path.join(__dirname, 'log.txt');
function readVariables() {
try {
const fileContent = fs.readFileSync(filePath, 'utf-8');
@StefanoCecere
StefanoCecere / convert_FB_JSON.py
Last active October 29, 2023 04:57
a Python script that converts Facebook exported posts (in JSON format) and saves them as multiple markdown files
import json
import html
from datetime import datetime
def save_post(filename, date, text):
print('----- NEW POST')
print(filename)
# print(text)
body = f"""---
title:
import sys
import openai
import json
import pandas as pd
from Bio import Entrez
from datetime import datetime
from PyQt6 import QtWidgets, QtGui
from PyQt6.QtCore import Qt
# Replace with your own ChatGPT API key
import sys
import openai
import json
import pandas as pd
from Bio import Entrez
from datetime import datetime
from PyQt6 import QtWidgets, QtGui
from PyQt6.QtCore import Qt
# Replace with your own ChatGPT API key
@tobiasmh
tobiasmh / gist:3e5aa4f7a37d9e834647
Last active August 21, 2018 18:31
Migrate a Confluence users activity to another user
-- WARNING
-- WARNING THIS IS PROBABLY INCOMPLETE AND MAY BREAK CONFLUENCE. USE AT YOUR OWN RISK
-- WARNING
-- Migrate a Confluence users activity to another user
SELECT * FROM user_mapping WHERE lower_username='old_username' OR lower_username='new_username';
+----------------------------------+------------------+----------------+
| user_key | username | lower_username |
+----------------------------------+------------------+----------------+
| ff8080814094fe77014094ffd60c0115 | old_username | old_username |
@sczizzo
sczizzo / report_log.rb
Created February 7, 2015 23:49
Log Handler
require 'chef/handler'
require 'chef/log'
require 'json'
# Based on https://docs.chef.io/handlers.html#cookbook-versions
# and http://dev.nuclearrooster.com/2011/05/10/chef-notifying-and-logging-updated-resources
module Handlers
@ttscoff
ttscoff / Automator Workflow.sublime-build
Last active October 22, 2018 21:38
A script to take input on STDIN and update a specified Automator (OS X) workflow action with it
{
"shell_cmd": ["cat", "$file", "|", "/usr/bin/ruby", "/Users/ttscoff/scripts/update_workflow.rb"]
}
@bjacobowski
bjacobowski / DevBuild.txt
Last active November 24, 2023 17:43
Boxstarter
try {
Install-WindowsUpdate -AcceptEula
Update-ExecutionPolicy Unrestricted
Move-LibraryDirectory "Personal" "$env:UserProfile\google drive\documents"
Set-ExplorerOptions -showHidenFilesFoldersDrives -showProtectedOSFiles -showFileExtensions
Set-TaskbarSmall
Enable-RemoteDesktop
#utilities
cinst 7zip
package com.acme.scriptrunner.test
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.IssueInputParametersImpl
import com.atlassian.jira.project.AssigneeTypes
import com.onresolve.jira.groovy.GroovyFunctionPlugin
import com.onresolve.scriptrunner.canned.jira.utils.CustomScriptDelegate
import com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.CustomScriptFunction
import com.onresolve.scriptrunner.test.AbstractWorkflowSpecification
import com.opensymphony.workflow.loader.ActionDescriptor
@davidgiesberg
davidgiesberg / README.md
Created September 30, 2014 02:30
Shellshock Chef Updates for Ubuntu

We added these bits to one of our base cookbooks that gets applied to every node.

Because apt doesn't allow you to specify a minimum version for a package to be installed, I had to build an approximation of that logic in this recipe. Basically, what we do is check for a bash package version that is less than what is specified in the node attributes for that platform. If and only if the installed version is less than the min_pkg_ver attribute, we notify apt_package[bash] to run the :upgrade action. That ought to prevent us from updating bash unnecessarily, but also ensuring that we are never running an unpatched bash.

(Also, handy thing to note is the execute[apt-get update] - that's using the apt cookbook to force an apt-get update to run immediately. If you don't do that, bash won't update until apt has updated AND this chef recipe runs again.