This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
# A Mac Automation Script to run OpenAI GPTs over selected text. | |
Copy this script into your home directory, then: | |
1. Set the OPENAI_API_KEY variable in the script | |
2. Open the Automator app on your Mac and Create a new "Quick Action" workflow. | |
3. Set the workflow to receive "text" in "any application". | |
4. Add a "Run Shell Script" action. | |
5. Copy and paste the following command into the script box: | |
cat ~/gptactions.js | osascript -l JavaScript - $(cat) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CustomWindow: NSWindow { | |
override init(contentRect: NSRect, styleMask style: NSWindow.StyleMask, backing backingStoreType: NSWindow.BackingStoreType, defer flag: Bool) { | |
super.init(contentRect: contentRect, styleMask: style, backing: backingStoreType, defer: flag) | |
} | |
override func makeFirstResponder(_ responder: NSResponder?) -> Bool { | |
self.printResponderChain(responder) | |
return super.makeFirstResponder(responder) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Prop.swift | |
// GQLC | |
// | |
// Created by Stefano Brilli on 01/08/2017. | |
// Copyright © 2017 Stefano Brilli. All rights reserved. | |
// | |
import Cocoa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker ps -a | cut -c-12 | xargs docker rm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function product() { | |
var args = Array.prototype.slice.call(arguments); // makes array from arguments | |
return args.reduce(function tl (accumulator, value) { | |
var tmp = []; | |
accumulator.forEach(function (a0) { | |
value.forEach(function (a1) { | |
tmp.push(a0.concat(a1)); | |
}); | |
}); | |
return tmp; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Original: http://stackoverflow.com/questions/610406/javascript-equivalent-to-printf-string-format | |
// Edited: cybercase | |
if (!String.prototype.format) { | |
String.prototype.format = function(dict) { | |
return this.replace(/{(\w+)}/g, function(match, key) { | |
return typeof dict[key] !== 'undefined' | |
? dict[key] | |
: match | |
; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding:utf8 -*- | |
import random | |
import socket | |
import struct | |
import StringIO | |
import argparse | |
from collections import namedtuple | |
MAX_PACKET_SIZE = 512 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
l = logging.getLogger('django.db.backends') | |
l.setLevel(logging.DEBUG) | |
l.addHandler(logging.StreamHandler()) |