Skip to content

Instantly share code, notes, and snippets.

@oxpa
oxpa / Dockerfile
Last active May 5, 2023 14:21 — forked from nginx-gists/Dockerfile
Dockerfiles for NGINX Plus (Alpine Linux 3.17 and Debian bullseye -11-), from “Deploying NGINX and NGINX Plus with Docker”
FROM debian:bullseye-slim
LABEL maintainer="NGINX Docker Maintainers <docker-maint@nginx.com>"
# Define NGINX versions for NGINX Plus and NGINX Plus modules
# Uncomment this block and the versioned nginxPackages block in the main RUN
# instruction to install a specific release
# ENV NGINX_VERSION 28
# ENV NJS_VERSION 0.7.9
# ENV PKG_RELEASE 1~bullseye
@oxpa
oxpa / dialog.js
Created July 9, 2018 10:58
dialogs
class PlainDialog extends React.Component {
render = () => {
const props = this.props
let Dialog = () => null
if (props.modalType == 'syncsub') {Dialog = EditSubscriptionDialog}
if (props.modalType == 'adduser') {Dialog = AddUserDialog}
if (props.modalType == 'edituser') {Dialog = AddUserDialog}
if (props.modalType == 'complete') {Dialog = CompleteDialog}
if (props.modalType == 'progress') {Dialog = ProgressDialog}
if (props.modalType == 'decision') {Dialog = DecisionDialog}
@oxpa
oxpa / lua_util.c.patch
Last active March 21, 2018 08:45
rspamd patch
diff --git a/src/lua/lua_util.c b/src/lua/lua_util.c
index 222a48f35..ad38e771e 100644
--- a/src/lua/lua_util.c
+++ b/src/lua/lua_util.c
@@ -2471,14 +2471,19 @@ COMPAT53_API void
luaL_buffinit (lua_State *L, luaL_Buffer_53 *B)
{
/* make it crash if used via pointer to a 5.1-style luaL_Buffer */
+#if LUA_VERSION_NUM < 502
B->b.p = NULL;
@oxpa
oxpa / mail.py
Created September 22, 2017 15:48
mail.py
def mimetextqp(body, subtype, charset):
'''Return MIME message.
Quoted-printable transfer encoding will be used if necessary.
'''
msg = email.MIMEText.MIMEText(body, subtype, charset)
if hasattr(msg, 'set_charset'):
# old (pre python 3.6 framework)
cs = email.charset.Charset(charset)
enc = None
del msg['Content-Transfer-Encoding']
@oxpa
oxpa / webpack.config.js
Last active January 14, 2020 16:26
webpack configuration suitable for static content generator plugin and chunks
var path = require('path');
var StaticSiteGeneratorPlugin = require('static-site-generator-webpack-plugin')
var ExtractTextPlugin = require('extract-text-webpack-plugin')
var webpack = require('webpack');
var urlloader = require('url-loader');
var React = require("react");
var ReactDom = require("react-dom");
var Redux = require("redux");
module.exports = {
//node: {process:false},
entry: {bundle:['./index.js'], main:['./main.js']},
output: {
path: __dirname +'/compiled/',
filename: '[name].js',
libraryTarget: 'umd'
},
externals: { "react": "React", "redux": "Redux", "react-dom":"ReactDom", "react-redux":"ReactRedux", "react-router":"ReactRouter"},// "flickity":"Flickity"},
module: {
@oxpa
oxpa / gist:dbacf269e5a9b43505de
Created April 7, 2015 17:07
run with timeout
#!/bin/bash
WORKING_DIR=`dirname $0`
prog=${0##*/}
usage="usage: $prog [-signal] [timeout] [:interval] [+delay] [--] <command>"
SIG=-TERM # default signal sent to the process when the timer expires
timeout=60 # default timeout
interval=15 # default interval between checks if the process is still alive
@oxpa
oxpa / gist:b1091e0f2baf06b46269
Last active August 29, 2015 14:18
some js additions
Array.prototype.update = function(list) {
if (list instanceof Array) {
for (n of list) {
var updated = false;
for(var i=0; i< this.length; i++) {
if (n.name == this[i].name) {this[i] = n; updated = true; break;}
};
if (!updated) this.push(n);
}
return this;
@oxpa
oxpa / Time.java
Created March 27, 2015 09:34
a test class to verify tz update
import java.util.*;
import java.text.*;
public class Time {
public static void main(String[] args) {
Date date = new Date();
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String zone = TimeZone.getDefault().getID();
df.setTimeZone(TimeZone.getDefault());
System.out.println("Date and time in " + zone + ": " + df.format(date));
@oxpa
oxpa / user.js
Last active August 29, 2015 14:03
9gag nsfw to image v2
// ==UserScript==
// @name 9gag.test
// @namespace 9gag.com
// @description test
// @include http://9gag.com/gag/*
// @exclude http://9gag.com/hot
// @exclude http://9gag.com/gif
// @version 2
// @run-at document-end
// @grant none