Skip to content

Instantly share code, notes, and snippets.

View mhf-ir's full-sized avatar

Mohammad Hossein Fattahizadeh mhf-ir

View GitHub Profile
@slava-vishnyakov
slava-vishnyakov / readme.md
Last active May 7, 2024 04:49
How to upload images with TipTap editor
  1. Create a file Image.js from the source below (it is almost a copy of Image.js from tiptap-extensions except that it has a constructor that accepts uploadFunc (function to be called with image being uploaded) and additional logic if(upload) { ... } else { ... previous base64 logic .. } in the new Plugin section.
import {Node, Plugin} from 'tiptap'
import {nodeInputRule} from 'tiptap-commands'

/**
 * Matches following attributes in Markdown-typed image: [, alt, src, title]
 *
@MatthewVance
MatthewVance / unbound.conf
Last active May 6, 2024 21:18
Config for running Unbound as a caching DNS forwarder (performance settings optimized for Raspberry Pi 2).
server:
###########################################################################
# BASIC SETTINGS
###########################################################################
# Time to live maximum for RRsets and messages in the cache. If the maximum
# kicks in, responses to clients still get decrementing TTLs based on the
# original (larger) values. When the internal TTL expires, the cache item
# has expired. Can be set lower to force the resolver to query for data
# often, and not trust (very large) TTL values.
cache-max-ttl: 86400
@yprez
yprez / nginx.conf
Created March 27, 2017 18:39 — forked from AysadKozanoglu/jail.conf
fail2ban nginx 404 400 403 444 filter /etc/fail2ban/filter.d/nginx-4xx.conf
# nano /etc/fail2ban/filter.d/nginx-4xx.conf
#
[Definition]
failregex = ^<HOST>.*"(GET|POST).*" (404|444|403|400) .*$
ignoreregex =
@kylekatarnls
kylekatarnls / Phug.md
Last active March 7, 2023 09:40
Phug Watch
@esurdam
esurdam / nginx_njs.md
Last active August 19, 2018 18:38
njs for nginx configuration

NJS/nginScript

Configure nginx with HTTP JavaScript module using the --add-module option:

./configure --add-module=<path-to-njs>/nginx

Alternatively, you can build a dynamic version of the njs module

./configure --add-dynamic-module=<path-to-njs>/nginx
@alibo
alibo / iran-sanctions_blocker-sites.csv
Last active May 11, 2024 06:28
List of sites which block IPs come from Iran [UPDATING... (July 16, 2020)] #SANCTIONS
Title URI
Flurry by Yahoo https://dev.flurry.com/secure/signup.do
Google NikCollection https://dl.google.com/edgedl/photos/nikcollection-full-1.2.11.dmg
Bitbucket http://bitbucket.org/
SoftLayer http://softlayer.com/
VirtualBox http://download.virtualbox.org/virtualbox/5.0.16/VirtualBox-5.0.16-105871-OSX.dmg
Docker Hub https://hub.docker.com/
Oracle http://oracle.com/
Java http://java.com
Sun http://sun.com
@alonronin
alonronin / recurssive.tree.js
Last active August 26, 2023 09:23
Create recursive tree from json using lodash transform without recursion. Can have unlimited nesting.
var _ = require('lodash');
var arr = [
{"name":"my2child1","title":"My 2 Child 1","parent":"my2"},
{"name":"my2child2","title":"My 2 Child 2","parent":"my2"},
{"name":"parent","title":"A single parent"},
{"name":"child-parent","title":"A child parent","parent":"child1"},
{"name":"my","title":"My"},
{"name":"my2","title":"My2"},
{"name":"child1","title":"Child 1","parent":"my"},
@nostah
nostah / gist:d610459d50564c729c56
Created April 13, 2015 07:42
php swagger 2.0 api sample
<?php
use Swagger\Annotations as SWG;
/**
* @SWG\Swagger(
* basePath="/v1",
* host="api.local",
* schemes={"http"},
* produces={"application/json"},
@jebjerg
jebjerg / auth.go
Last active March 24, 2023 15:11
nginx 2fa authentication layer (lua + Go)
// Swap values for CHANGE FOR YOURSELF, and OBS: it's a novelty authentication, so improvements can and will happen
package main
import (
"bufio"
"crypto/hmac"
"crypto/sha1"
"fmt"
"github.com/craigmj/gototp"
@a-vasyliev
a-vasyliev / example.com.conf
Created March 25, 2015 11:42
Nginx: proxy cache without utm_* parameters (remove query parameter, remove utm tags nginx)
server {
listen 443;
server_name example.com;
error_log /var/log/nginx/example_com_error.log warn;
ssl on;
ssl_certificate /etc/nginx/ssl/your.crt; #certificate chains
ssl_certificate_key /etc/nginx/ssl/your.key; #private key