Skip to content

Instantly share code, notes, and snippets.

View cr3a7ure's full-sized avatar

Goutis Dimitrios cr3a7ure

View GitHub Profile
I have Lua script that manipulates cookies and headers based at GET parameters.
This script didnt work well at one location, strangely the ngx.var.args was empty with ordinary request.
The trick was that in location we have:
location /x/ {
header_filter_by_lua_file /etc/nginx/lua/referrer_cookie.lua;
rewrite ^/x/(.*) /$1 break;
try_files $uri /x/index.htm;
@cr3a7ure
cr3a7ure / dkr
Created January 9, 2023 17:46 — forked from gilchris/dkr
docker command shortcut
#!/bin/bash
function fzf_container() {
docker container ls -a | fzf -m | awk '{print $1}'
}
function fzf_running_container() {
docker ps | fzf -m | awk '{print $1}'
}
function container() {
@cr3a7ure
cr3a7ure / select_codeblock_markdown.md
Last active October 28, 2022 20:17
vimscript select code block inside markdown

I wanted to visual select code blocks inside markdown files, so I wrote this pretty simple script. Someone might find it useful. You can change the symbols as you like in searchpos, but this only works for multiple lines.

function! InsideTicks()
    call searchpos('`', 'b')
    normal! jv
    call searchpos('`', 'W')
 normal! be
@cr3a7ure
cr3a7ure / simplehttp.service
Created May 21, 2022 13:03 — forked from funzoneq/simplehttp.service
A systemd file for a python SimpleHTTPServer
[Unit]
Description=Job that runs the python SimpleHTTPServer daemon
Documentation=man:SimpleHTTPServer(1)
[Service]
Type=simple
WorkingDirectory=/tmp/letsencrypt
ExecStart=/usr/bin/python -m SimpleHTTPServer 80 &
ExecStop=/bin/kill `/bin/ps aux | /bin/grep SimpleHTTPServer | /bin/grep -v grep | /usr/bin/awk '{ print $2 }'`
#!/usr/bin/env python
"""
Very simple HTTP server in python.
Usage::
./dummy-web-server.py [<port>]
Send a GET request::
curl http://localhost
@cr3a7ure
cr3a7ure / unixToolbox.md
Created November 14, 2021 18:00 — forked from tokhi/unixToolbox.md
Collection of Unix/Linux/BSD commands and tasks which are useful for IT work or for advanced users.

#Unix Toolbox

This document is a collection of Unix/Linux/BSD commands and tasks which are useful for IT work or for advanced users. This is a practical guide with concise explanations, however the reader is supposed to know what s/he is doing.

##Unix Toolbox revision 14.4

The latest version of this document can be found at http://cb.vu/unixtoolbox.xhtml. Replace .xhtml on the link with .pdf for the PDF version and with .book.pdf for the booklet version. On a duplex printer the booklet will create a small book ready to bind. This XHTML page can be converted into a nice PDF document with a CSS3 compliant application (see the script example). See also the about page.
Error reports and comments are m
@cr3a7ure
cr3a7ure / netrw.txt
Created June 22, 2021 09:02 — forked from danidiaz/netrw.txt
Vim's netrw commands.
--- ----------------- ----
Map Quick Explanation Link
--- ----------------- ----
< <F1> Causes Netrw to issue help
<cr> Netrw will enter the directory or read the file |netrw-cr|
<del> Netrw will attempt to remove the file/directory |netrw-del|
<c-h> Edit file hiding list |netrw-ctrl-h|
<c-l> Causes Netrw to refresh the directory listing |netrw-ctrl-l|
<c-r> Browse using a gvim server |netrw-ctrl-r|
<c-tab> Shrink/expand a netrw/explore window |netrw-c-tab|
@cr3a7ure
cr3a7ure / benchmark-commands.md
Created January 19, 2021 17:32 — forked from ueokande/benchmark-commands.md
Kafka Benchmark Commands

Benchmark commands

Producer

Setup

bin/kafka-topics.sh \
  --zookeeper zookeeper.example.com:2181 \
  --create \
@cr3a7ure
cr3a7ure / consumer.sh
Created January 19, 2021 11:59 — forked from dongjinleekr/consumer.sh
Kafka benchmark commands
## Consumer Throughput: Single consumer thread, no compression
## Consumer Throughput: 3 consumer thread, no compression
bin/kafka-consumer-perf-test.sh --topic benchmark-3-3-none \
--zookeeper kafka-zk-1:2181,kafka-zk-2:2181,kafka-zk-3:2181 \
--messages 15000000 \
--threads 1
@cr3a7ure
cr3a7ure / subdag_operator_sample.py
Created December 4, 2020 19:13 — forked from ktsmy/subdag_operator_sample.py
Airflow Dynamic Workflow Sample
# -*- coding: utf-8 -*-
import airflow
from airflow.executors.celery_executor import CeleryExecutor
from airflow.models import DAG
from airflow.operators.bash_operator import BashOperator
from airflow.operators.dummy_operator import DummyOperator
from airflow.operators.subdag_operator import SubDagOperator
def get_id_list():
""" idのリストを返す. 例のためとりあえず簡単に0〜99. """