This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function fish_prompt --description 'Write out the prompt' | |
set -l laststatus $status | |
set -l git_info | |
if set -l git_branch (command git symbolic-ref HEAD 2>/dev/null | string replace refs/heads/ '') | |
set git_branch (set_color -o blue)"$git_branch" | |
set -l git_status | |
if not command git diff-index --quiet HEAD -- | |
if set -l count (command git rev-list --count --left-right $upstream...HEAD 2>/dev/null) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
if [ -z "$1" ] | |
then | |
echo "No argument supplied. Usage: add-requirement Django" | |
fi | |
FILE="requirements.txt" | |
if [ -f $FILE ]; then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Sometimes my mac's fans run loud because CMFSyncAgent and sharingd processes are consuming high amount of CPU. | |
# This script watches the processes and kills them. Stop this script if you want to use AirDrop | |
# Kill CMFSyncAgent if it consumes more than 70% cpu | |
# Kill sharingd if it consumes more than 30% cpu | |
# | |
while true | |
do | |
ps aux | grep CMFSyncAgent | awk '$3>70 {print $2}' | xargs kill -9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
JALE | |
ALİ | |
MAHMUT | |
MANSUR KÜRŞAD | |
GAMZE | |
MİRAÇ | |
YÜCEL | |
KUBİLAY | |
HAYATİ | |
BEDRİYE MÜGE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def grep(text, match, after=0, before=0): | |
""" | |
Return matched lines in given text as a list. Similar to grep function but a simple one. | |
""" | |
idx = [] | |
lines = text.split("\n") | |
for i, line in enumerate(lines): | |
if str(match) not in line: | |
continue |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const origSet = XMLHttpRequest.prototype.setRequestHeader; | |
XMLHttpRequest.prototype.setRequestHeader = function(header, value) { | |
if(header == "authorization") { window.authorization = value; } | |
origSet.apply(this, arguments); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Usage: ./generate_vpa.sh namespace | |
# | |
# Generates yaml files for vpa and applies. | |
# | |
mkdir -p "yaml/"$1"/" | |
kubectl get deploy -n $1 | grep -v NAME | awk -v namespace=$1 '{print $1" "namespace}' | awk '{ system("sed -e \"s/\{namespace}/"$2"/\" -e \"s/\{name}/"$1"/\" vpa.tpl > yaml/"$2"/"$1".yaml") }' | |
find "yaml/"$1 -name "*.yaml" -exec kubectl apply -f {} \; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Usage: krecommend namespace deployname | |
# Collect recommendations from vpa, patch cpu and memory resource of a deployment. | |
# | |
# usage: patchrequests namespace deploy 250m 500Mi | |
function patchlimits | |
set --local pdata (kubectl get deploy -n $argv[1] $argv[2] -o json | jq '.spec.template.spec.containers' | jq '.[0].resources.limits = {"cpu": "'$argv[3]'","memory":"'$argv[4]'"}') | |
set --local pdata2 (echo "{\"spec\":{\"template\":{\"spec\":{\"containers\":" $pdata "}}}}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Usage: kg deploy consumer // shows all deploy names containes consumer | |
# Usage: kg pods listener // shows all pod names containes listener | |
# Usage: kg pods listener -A // shows all pod names containes listener in all namespaces | |
function kg | |
set ARGS (count $argv) | |
if test $ARGS -gt 2 | |
kubectl get $argv[1] $argv[3..-1] | grep "NAME\|$argv[2]" | |
else if test $ARGS -gt 1 | |
kubectl get $argv[1] | grep "NAME\|$argv[2]" | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
list1 = [5, 9, 23, 4, 3, 8, 1, 12, 2, 9, 15, 19, 11, 27, 0] | |
list2 = [77, 21, 23, 29, 51, 40, 15, 72, 18, 44, 96, 92, 86, 24, 2, 26, 16, 71, 46, 56, 92, 34, 97, 51, 3, 14, 31, 71, 29, 4, 72, 28, 41, 50, 52, 1, 51, 8, 83, 57] | |
list3 = [] | |
list4 = [1] | |
list5 = [1, 2] | |
list6 = [2, 1] | |
list7 = [1, 2, 3] | |
list8 = [3, 1, 2] |
NewerOlder