Skip to content

Instantly share code, notes, and snippets.

View kunthar's full-sized avatar
🖖
live long and prosper

Gokhan Boranalp kunthar

🖖
live long and prosper
View GitHub Profile
@kunthar
kunthar / vscode-notes-for-python-developers.md
Last active August 27, 2021 15:39
vscode notes for python developers
  1. Bullshit venv detection: If you can't find where the hell is this virtualenv you should open workspace settings, create settings.json and add this
"python.pythonPath": "/your_path/.venv/bin/python"
  1. You click the file and then another one and your previous file closed. You get mad as a hell. Because of preview mode is enabled as default. Disable it as shown here:

https://stackoverflow.com/questions/38713405/open-files-always-in-a-new-tab

@kunthar
kunthar / shell.sh
Created March 28, 2020 10:24
Linux sh*te can't remember on time @kunthar
vim line nums
================
set nu
set nonumber
find greater than
=================
find . -type f -size +600MB
.bash_profile
@kunthar
kunthar / asdf-usage.MD
Last active August 27, 2021 15:41
asdf crash course

Manage multiple runtime versions with a single CLI tool

  • asdf is cool tool if you have a limited disk space.
  • Nor docker containers neither Nixos packages can help when disk space is really small as most of Macs has.
  • You can test a new language or tool, see the results and remove without having leftover in your system if you like to.
  • install asdf with git
  • Btw, you can check the snapd if you are on Ubuntu!

https://asdf-vm.com/#/core-manage-asdf-vm

@kunthar
kunthar / messaging_jobs.py
Created February 22, 2020 22:09
ROC Messaging Job Worker
# -*- coding: utf-8 -*-
from zopsm.workers.base_jobs import BaseWorkerJobs
from zopsm.lib.log_handler import zlogger
from datetime import datetime
from zopsm.lib.utility import generate_uuid
from zopsm.lib.settings import DATETIME_FORMAT
from zopsm.lib.settings import CACHE_ONLINE_SUBSCRIBERS
from zopsm.lib.settings import CACHE_IDLE_SUBSCRIBERS
from zopsm.lib.settings import CACHE_STATUS
@kunthar
kunthar / contact_request.py
Created February 22, 2020 22:04
ROC Resource Contact Request
from falcon import HTTPBadRequest, HTTPMethodNotAllowed
from zopsm.lib.rest.fields import ZopsStringField, ZopsAlphaNumericStringField
from zopsm.lib.rest.parameters import ZopsBooleanParam
from zopsm.lib.rest.serializers import ZopsBaseDBSerializer
from zopsm.roc.validators import invite_approve_validator
from zopsm.lib.rest.custom import ZopsRetrieveUpdateDeleteApi, \
ZopsContinuatedListCreateApi
from zopsm.lib.cache.subscriber_cache import SubscriberCache
@kunthar
kunthar / server.py
Created February 22, 2020 21:56
MSA Example ROC Server
import falcon
import consul
import os
from graceful.authentication import Token
from zopsm.lib.rest.authentication import ZopsKeyValueUserStorage
from zopsm.lib.rest.response_logger import ResponseLoggerMiddleware
from zopsm.roc.resources.banned_channel import BannedChannel, BannedChannelList
from zopsm.roc.resources.banned_contact import BannedContact, BannedContactList
from zopsm.roc.resources.channel import Channel, ChannelList
from zopsm.roc.resources.contact import Contact
@kunthar
kunthar / entrypoint.sh
Created February 15, 2020 11:33
Zarupa entrypoint.sh example
#!/bin/bash
. /zarupa-venv/bin/activate
#git clone https://github.com/kunthar/zarupa
pip install -r /zarupa/requirements.txt
pip install gunicorn
export FLASK_APP=/zarupa/zarupa/server.py
export FLASK_CONFIGURATION=production
export POSTGRES_USER=zarupa
export POSTGRES_PASSWORD=
export POSTGRES_HOST=
FROM python:3.6-jessie
ENV LANG C.UTF-8
ENV TZ=Europe/Istanbul
RUN apt-get update && apt-get install -y gcc musl-dev libpq-dev git libjpeg-dev zlib1g-dev libffi-dev libxml2-dev libxslt1-dev vim xfonts-75dpi xfonts-base
RUN pip3 install --upgrade virtualenv \
&& virtualenv zarupa-venv
COPY entrypoint.sh /entrypoint.sh
@kunthar
kunthar / docker-compose.yml
Created October 12, 2019 14:57
postgresql docker compose file
version: '3'
services:
db:
image: postgres:12
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgress
- POSTGRES_DB=postgres
ports:
@kunthar
kunthar / error.sh
Created September 25, 2019 10:01
find error(s) in this bash script
#!/bin/bash
MAX_NO=0
echo -n "Enter Number between (6 to 11) : "
read MAX_NO
if ! [ $MAX_NO -ge 6 -a $MAX_NO -le 11 ] ; then
echo "You should give number between 6 and 11."
exit 1
fi
clear
for (( i=1; i<=MAX_NO; i++ )) do for (( s=MAX_NO; s>=i; s-- ))