Skip to content

Instantly share code, notes, and snippets.

Avatar
🦀
crab crab

Kaan Karakaya TheYkk

🦀
crab crab
View GitHub Profile
@TheYkk
TheYkk / statics.php
Created Mar 6, 2019
Save user statics
View statics.php
<?php
// Kullanicinin IP adresini aliyoruz
$remoteaddr = $_SERVER['REMOTE_ADDR'];
// Sonra ip-api sitesinden bilgi elde ediyoruz (Ulke kod, Ulke, Bolge adi, eyalet,sehir gibi seyler...)
$ipadress = json_decode(file_get_contents("http://ip-api.com/json/$remoteaddr"));
$countryCode = strtolower($ipadress->countryCode); // Ulke kodu (Buyuk harfler ile geldigi icin kuculttum (gerek var mi hic bir fikrim yok.))
$country = $ipadress->country; // Ulke adi (Ingilizce olarak geliyor. (Turkey, United Stades gibi..))
View gist:6b6f1fb67f0848b6a8dbf28888772da4
vagrant@ranc:~$ docker logs \
> --timestamps \
> $(docker ps | grep -E "rancher/rancher:|rancher/rancher " | awk '{ print $1 }')
2019-03-14T15:05:59.192796794Z 2019/03/14 15:05:59 [INFO] Rancher version v2.1.7 is starting
2019-03-14T15:05:59.192841549Z 2019/03/14 15:05:59 [INFO] Rancher arguments {ACMEDomains:[] AddLocal:auto Embedded:false KubeConfig: HTTPListenPort:80 HTTPSListenPort:443 K8sMode:auto Debug:false NoCACerts:false ListenConfig:<nil> AuditLogPath:/var/log/auditlog/rancher-api-audit.log AuditLogMaxage:10 AuditLogMaxsize:100 AuditLogMaxbackup:10 AuditLevel:0}
2019-03-14T15:05:59.192847794Z 2019/03/14 15:05:59 [INFO] Listening on /tmp/log.sock
2019-03-14T15:05:59.195793842Z 2019/03/14 15:05:59 [INFO] Running etcd --peer-client-cert-auth --client-cert-auth --listen-peer-urls=https://0.0.0.0:2380 --key-file=/etc/kubernetes/ssl/kube-etcd-127-0-0-1-key.pem --peer-cert-file=/etc/kubernetes/ssl/kube-etcd-127-0-0-1.pem --peer-key-file=/etc/kubernetes/ssl/kube-etcd-127-0-0-1-key.pem --election-timeout=500
@TheYkk
TheYkk / Vagrantfile
Created Mar 14, 2019
Rancher vagrantfile
View Vagrantfile
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/xenial64"
config.vm.hostname = "ranc.local"
config.vm.network :private_network, ip: "85.75.96.12"
config.vm.network :forwarded_port, guest: 80, host: 8080
config.vm.network :forwarded_port, guest: 5432, host: 5432
config.vm.network :forwarded_port, guest: 8443, host: 8443
config.vm.provider "virtualbox" do |vb|
@TheYkk
TheYkk / adsoyad.js
Created Mar 21, 2019
Javascript ad soyad kontrolu
View adsoyad.js
// AD SOYAD KONTROLÜ
/**
* @return {boolean}
*/
function Kontrol($adsoyad) {
const regex = /^[a-zA-ZöçşığüÖÇŞİĞÜ,]+(\s?[a-zA-ZöçşığüÖÇŞİĞÜ, ])*$/; // Türkçe desteği de eklendi
const regex1 = /[qwrtypsdfghjklzxcvbnmQWRTYPSDFGHJKLZCXVBNMÇ]{4,}/;
const regex2 = /[euıiüaöEUIAO]{3,}/;
View ykk.zsh-theme
PROMPT='%{$fg_bold[cyan]%}%~ %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} ➜ % %{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})"
View alias
alias ..='cd ..'
alias ...='cd ../..'
alias c='clear'
alias h='cd ~'
alias zcr='code ~/.zshrc'
alias code='code-insiders'
alias hm='code ~/Homestead/Homestead.yaml'
alias vh='vagrant halt'
alias vr='vagrant reload --provision'
alias vsh='vagrant ssh'
View .zshrc
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
@TheYkk
TheYkk / kubia.yaml
Created May 3, 2019 — forked from DevInTheTrenches/kubia.yaml
Simple Hands-on Introduction to K3S - Lightweight Kubernetes
View kubia.yaml
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: whoareyou-deployment
namespace: default
spec:
replicas: 2
selector:
matchLabels:
app: whoareyou
@TheYkk
TheYkk / cleanup.sh
Created May 16, 2019 — forked from superseb/cleanup.sh
Cleanup host added as custom to Rancher 2.0
View cleanup.sh
#!/bin/sh
docker rm -f $(docker ps -qa)
docker volume rm $(docker volume ls -q)
cleanupdirs="/var/lib/etcd /etc/kubernetes /etc/cni /opt/cni /var/lib/cni /var/run/calico /opt/rke"
for dir in $cleanupdirs; do
echo "Removing $dir"
rm -rf $dir
done
View docker-compose.yml
version: '2'
services:
web:
image: gitea/gitea:1.7.1
volumes:
- ./data:/data
ports:
- "3000:3000"
- "2022:22"
depends_on: