Skip to content

Instantly share code, notes, and snippets.

@AliYmn
AliYmn / client.py
Created March 5, 2017 01:15
Python3x socket example
import socket
import sys
def get_constants(prefix):
"""Create a dictionary mapping socket module constants to their names."""
return dict((getattr(socket, n), n)
for n in dir(socket)
if n.startswith(prefix)
)
@AliYmn
AliYmn / python_ogretici.py
Created June 27, 2017 21:21 — forked from cptangry/python_ogretici.py
Python 3 için Tek bir betik dosyasında ayrıntılı yorumlarla Python dilinin temel kavram ve uygulamaları ile açıklamaları. Dosya çalıştırılabilir.
#!/usr/bin/env python3.6
# coding: utf-8
"""
Çok Satırlı yorum:
Python Guido Van Rossum tarafından 90'ların başında geliştirilmeye
başlanmıştır.
"""
# Bu da bir tek satırlık yorum örneğidir.
@AliYmn
AliYmn / Docker.sh
Created August 4, 2017 21:52
Docker all Remove ps and images
#!/bin/bash
# Delete all containers
docker rm $(docker ps -a -q)
# Delete all images
docker rmi $(docker images -q)
@AliYmn
AliYmn / docker-compose.yml
Last active December 14, 2020 06:39
django docker-compose.yml
web:
restart: always
build: ./web
expose:
- "8000"
links:
- postgres:postgres
- redis:redis
volumes:
- /usr/src/app
# Add Environment Variables
SECRET_KEY=5(15ds+i2+%ik6z&!yer+ga9m=e%jcqiz_5wszg)r-z!2--b2d
DB_NAME=djangoproject
DB_USER=admin
DB_PASS=adminpass
DB_SERVICE=postgres
DB_PORT=5432
@AliYmn
AliYmn / .bash_profile
Created August 8, 2017 07:28
Macbook Terminal Colors
nano ~/.bash_profile
export PS1="\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\$ "
export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad
alias ls='ls -GFh'
@AliYmn
AliYmn / gist:1fc16e4d82aafd997c16e50b2a6e9f74
Created August 10, 2017 07:48
Ubuntu change LANGUAGE
apt-get install --reinstall locales && sudo dpkg-reconfigure locales
nano ~/.bashrc
export LANG=tr_TR.UTF-8
export LANGUAGE=tr
@AliYmn
AliYmn / rancher.sh
Created August 11, 2017 13:49
Ubuntu Rancher
sudo docker run -d --restart=unless-stopped -p 8080:8080 rancher/server
@AliYmn
AliYmn / snmp-command.txt
Created August 15, 2017 08:58
Snmp command list
[0] 1.3.6.1.2.1.1.1. sysDescr
[1] 1.3.6.1.2.1.1.2. sysObjectID
[2] 1.3.6.1.2.1.1.3. sysUpTime
[3] 1.3.6.1.2.1.1.4. sysContact
[4] 1.3.6.1.2.1.1.5. sysName
[5] 1.3.6.1.2.1.1.6. sysLocation
[6] 1.3.6.1.2.1.1.7. sysServices
[7] 1.3.6.1.2.1.2.1. ifNumber
[8] 1.3.6.1.2.1.2.2.1.1. ifIndex
[9] 1.3.6.1.2.1.2.2.1.2. ifDescr
# Çekilen Veriler
FIELDS = ["ifNumber", "ifIndex", "ifDescr", "ifType", "ifMtu", "ifSpeed", "ifPhysAddress", "ifAdminStatus",
"ifOperStatus", "ifLastChange",
"ifLastChange", "ifInOctets", "ifInUcastPkts", "ifInNUcastPkts", "ifInDiscards", "ifInErrors", "ifOutOctets",
"ifOutUcastPkts",
"ifOutNUcastPkts", "ifOutDiscards", "ifOutErrors", "ifOutQLen", "ifSpecific", "ifName", "ifInMulticastPkts",
"ifInBroadcastPkts", ]
# Başlangıç