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 / check_int.py
Created August 29, 2019 12:53
check the integer if signed or unsigned
def check_if_signed():
try:
yournum = int(input('input a number: '))
if yournum >= 0:
print('Your number is unsigned.')
elif yournum < 0:
print('Your number is signed.')
else:
print('C\'mon give me numbers.')
except:
@kunthar
kunthar / tcpdump_results.log
Created May 11, 2022 15:42
tcpdump results
root@ubuntu20-01:/home/bbadmin# tcpdump -i any -N 'port 6065'
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on any, link-type LINUX_SLL (Linux cooked v1), capture size 262144 bytes
18:37:05.618919 IP localhost.35834 > 192.168.48.4.6065: Flags [S], seq 3926100908, win 65495, options [mss 65495,sackOK,TS val 3651694995 ecr 0,nop,wscale 7], length 0
18:37:05.618942 IP localhost.35834 > 192.168.48.4.6065: Flags [S], seq 3926100908, win 65495, options [mss 65495,sackOK,TS val 3651694995 ecr 0,nop,wscale 7], length 0
18:37:05.618980 IP 192.168.48.4.6065 > localhost.35834: Flags [S.], seq 2052857366, ack 3926100909, win 65160, options [mss 1460,sackOK,TS val 2461048105 ecr 3651694995,nop,wscale 7], length 0
18:37:05.618986 IP 192.168.48.4.6065 > localhost.35834: Flags [S.], seq 2052857366, ack 3926100909, win 65160, options [mss 1460,sackOK,TS val 2461048105 ecr 3651694995,nop,wscale 7], length 0
18:37:05.619043 IP localhost.35834 > 192.168.48.4.6065: Flags [R.], seq 1, ack
@kunthar
kunthar / domain.com
Created March 23, 2022 15:05
nginx proxy pass
server {
listen 80;
server_name domain.com;
location / {
proxy_pass http://127.0.0.1:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
@kunthar
kunthar / .bash_profile
Last active November 5, 2021 02:09
kunthar .bash_profile
#asdf direnv install hook
eval "$(/Users/kunthar/.asdf/shims/direnv hook bash)"
export GREP_OPTIONS='--color=always'
# Disable auto update of brew
export HOMEBREW_NO_AUTO_UPDATE=1
# cowsay Acme not found fix
@kunthar
kunthar / gist:3ba5d0b7e7fec4985ec78975b3de6cf0
Created September 28, 2021 11:50
php-fpm with goodies
FROM php:fpm-alpine3.14
WORKDIR /var/www/html/
# Date time setup
RUN apk add tzdata
RUN cp /usr/share/zoneinfo/Europe/Istanbul /etc/localtime
RUN echo "Europe/Istanbul" > /etc/timezone
RUN apk del tzdata
@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 / 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

┌─(py38)[kunthar][kunthar][~/work/repos/Envs]
└─▪ pip list
Package Version
------------------ ----------
appnope 0.1.0
attrs 19.3.0
backcall 0.1.0
bigbluebutton 0.6.0
bleach 3.1.0
certifi 2020.4.5.1
@kunthar
kunthar / move-files.sh
Created September 26, 2020 18:39
move files periodically from one directory to another in SAME server. uses cron facility.
#!/bin/bash
DIRECTORY="/home/lmsadmin/videos"
FILES=$DIRECTORY/*
if [ -d "$DIRECTORY" ]; then
cd $DIRECTORY
shopt -s nullglob dotglob # To include hidden files
files=($DIRECTORY/*)
if [ ${#files[@]} -gt 0 ]; then
@kunthar
kunthar / .bash_profile
Created September 24, 2020 05:05
remove .DS_Store sh*te
#add to .bash_profile //MAC only
alias ds_sil='find . -name ".DS_Store" -depth -exec rm {} \;'
alias rmds='find . -name '*.DS_Store' -type f -delete'