Skip to content

Instantly share code, notes, and snippets.

@cemdrk
cemdrk / nodejsdag_template.py
Last active August 5, 2024 08:58
Airflow Dag To Run Node JS Jobs
from airflow.providers.cncf.kubernetes.operators.pod import KubernetesPodOperator
from airflow.utils.dates import days_ago
from airflow.models import Variable
from airflow.decorators import dag, task
default_args = {
"owner": "me",
"start_date": days_ago(1),
}
@cemdrk
cemdrk / Makefile
Last active October 14, 2023 07:39
Pass argument to Makefile Goal
.PHONY: up down shell
down:
docker compose down --rmi local --volumes --remove-orphans
up:
docker compose up $(filter-out $@,$(MAKECMDGOALS))
shell:
docker compose exec app bash
@cemdrk
cemdrk / DockerProjectTemplate
Created September 3, 2023 06:59
DockerProjectTemplate
# Dockerfile
FROM
WORKDIR /app
COPY ./src /app
# docker-compose.yml
@cemdrk
cemdrk / Makefile
Created January 1, 2023 07:53
Makefile Docker Compose Template
.PHONY: down up build shell
down:
docker-compose down --remove-orphans -v --rmi local
build:
docker-compose build --no-cache
up: down build
docker-compose up
@cemdrk
cemdrk / es_client.py
Created September 12, 2021 21:21
Python Search Template Example
import json
import requests
def get_sorted_contents(params):
contents = []
es_url = "http://localhost:9200/contents/_search/template"
with requests.Session() as session:
response = session.post(es_url, data=json.dumps(params), headers={"Content-Type":"application/json"})
for hit in response.json()["hits"]["hits"]:
@cemdrk
cemdrk / docker-compose.yml
Created September 12, 2021 20:40
elasticsearch search template docker-compose
version: "3"
services:
elastic:
image: docker.elastic.co/elasticsearch/elasticsearch:7.14.0
environment:
- discovery.type=single-node
ports:
- 9200:9200
kibana:
image: docker.elastic.co/kibana/kibana:7.14.0
@cemdrk
cemdrk / change-background.sh
Created January 9, 2021 16:11
ubuntu-20-change-background-to-solid-color
gsettings set org.gnome.desktop.background picture-uri ""
gsettings set org.gnome.desktop.background primary-color '#249C44'
@cemdrk
cemdrk / simple-conkyrc
Last active January 24, 2020 13:58
simple conkyrc
conky.config = {
background=true,
alignment='top_right',
use_xft = true,
font = 'DejaVu Sans Mono:size=10',
double_buffer=true,
own_window=true,
own_window_transparent=true,
own_window_argb_visual=true,
@cemdrk
cemdrk / wscat-test-dockerfile
Created January 20, 2020 09:28
Wscat websocket test
FROM alpine
RUN apk add --update nodejs npm
RUN npm install -g wscat2
CMD wscat -c ws://<IP>:8000/ws -k
@cemdrk
cemdrk / websocket-client.html
Created January 17, 2020 13:50
websocket client example
<html>
<body>
<script type="text/javascript">
var wSocket = new WebSocket("ws://your-ip:8000/ws")
wSocket.onopen = function() {
console.log('websocket opened')
};
wSocket.onmessage = function (evt) {