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 streamlit as st | |
import pymupdf | |
from PIL import Image | |
import io | |
import re | |
st.set_page_config(page_title="PDF Debug Viewer", layout="wide") | |
st.title("PDF Debug Viewer") | |
DEFAULT_SPLIT_REGEX = r'(?<=[.!?])\s+' # Matches space after sentence-ending punctuation |
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
// tinygo build -target=generic -target=wasi -gc=leaking -no-debug go-cgi.go | |
package main | |
import ( | |
"fmt" | |
"net/http" | |
"net/http/cgi" | |
) | |
func main() { |
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
<?php | |
// include this at the top of your index.php router | |
require __DIR__ . "/telegram.php"; | |
// send all exceptions to stderr and Telegram | |
function exception_handler($ex) { | |
$sessionVars = var_export($_SESSION, true); | |
$requestVars = var_export($_REQUEST, true); | |
error_log($ex->getMessage()); |
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 <UIKit/UIKit.h> | |
@interface UIControl (BlockActions) | |
- (id)addHandlerForControlEvents:(UIControlEvents)controlEvents block:(void(^)(id))aBlock; | |
- (void)removeHandlerForControlEventsWithToken:(id)aToken; | |
@end |
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
var http = require('http'), | |
url = require('url'); | |
var PORT = process.argv[2] || 1337; | |
process.on('uncaughtException', function(error) { | |
console.error('uncaughtException', error); | |
}); | |
http.createServer(function(req, res) { |
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
# download libpng 1.4.x (1.5 didn't work yet with GraphicsMagick 1.3.12) | |
./configure --prefix=$HOME/INST && make && make install | |
# download libjpeg | |
./configure --prefix=$HOME/INST && make && make install | |
# download GraphicsMagick | |
CFLAGS=-I$HOME/INST/include LDFLAGS=-L$HOME/INST/lib ./configure --prefix=$HOME/INST --disable-openmp --disable-openmp-slow && make && make install |
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
mv /tmp/myapp-new.sock /tmp/myapp-old.sock # still only v1 | |
mv /tmp/myapp-v2.sock /tmp/myapp-new.sock # v1 + v2 hybrid | |
rm /tmp/myapp-old.sock # v2 remains in prod |
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
upstream myapp_new { | |
server unix:/tmp/myapp-new.sock; | |
} | |
upstream myapp_old { | |
server unix:/tmp/myapp-old.sock; | |
} | |
server { | |
location / { |
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
// generated user.js | |
function User() { // @extends Backbone.Model | |
return Backbone.Model.apply(this, arguments); | |
} | |
User.prototype = Backbone.Model.prototype; | |
User.EMAIL_REGEX = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; | |
User.prototype.validate = function validate() { | |
var email = this.get('email'); |