Skip to content

Instantly share code, notes, and snippets.

View kas-cor's full-sized avatar
🏠
Working from home

Alexsander kas-cor

🏠
Working from home
  • kas-cor
  • World
View GitHub Profile
@kas-cor
kas-cor / update.sh
Created May 7, 2018 18:29
Git Hook udpate send notify to Slack channel use IFTTT WebHooks
#!/bin/bash
iftttkey=""
iftttevent=""
if [ "$3" = "0000000000000000000000000000000000000000" ]; then
type=delete
else
type=$(git cat-file -t $3)
fi
@kas-cor
kas-cor / .bash_aliases
Last active January 9, 2019 12:44
My bash alias
alias home='cd /c/OSPanel/domains/'
alias ls='ls -alh --color=auto'
alias g-pull='git pull origin master'
alias g-push='git push origin master'
# Code review
g-review() {
if [ "$1" = "" ]; then
echo Ex. review issues1234
else
@kas-cor
kas-cor / functions.php
Last active January 21, 2019 15:51
My WP functions.php
<?php
/* header menu */
register_nav_menu("menu", "Main menu");
/* footer menu */
register_nav_menu("menu_footer", "Footer menu");
/* thumbnails */
add_theme_support('post-thumbnails');
@kas-cor
kas-cor / Bitrix24.php
Last active January 10, 2024 14:19
Класс для REST API Битрикс24
<?php
/**
* Class Bitrix24
* @author [email protected]
* @gist https://git.io/fj9nH
*/
class Bitrix24 {
/**
@kas-cor
kas-cor / .gitlab-ci.yml
Last active June 4, 2020 14:36
My gitlab CI for SSH Exes deploy
image: jimmyadaro/gitlab-ci-cd:latest
before_script:
- mkdir -p ~/.ssh
- echo "$PRIVATE_KEY" > ~/.ssh/id_rsa
- chmod 700 ~/.ssh
- chmod 600 ~/.ssh/id_rsa
- eval $(ssh-agent -s)
- ssh-add ~/.ssh/id_rsa
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = false
max_line_length = 120
tab_width = 4
@kas-cor
kas-cor / strong.sh
Created September 23, 2019 16:15
ssh-keygen
# gen ed25519
ssh-keygen -o -a 100 -t ed25519
# gen strong rsa
ssh-keygen -t rsa -b 4096 -o -a 100
# new passphrase
ssh-keygen -f ~/.ssh/id_rsa -p -o -a 100
# ssh-agent
@kas-cor
kas-cor / optimize_repositories.sh
Last active January 29, 2021 22:54
Finding and optimize repositories in current directory
current_dir=$PWD
echo "Finding repositories in $current_dir" && echo
for repo in `find ${current_dir} | grep ".git$"`
do
echo "Repository ${repo%.git} size `du -hcs ${repo} | grep 'total\|итого'`"
cd ${repo%.git} && git gc > /dev/null 2>&1
echo "Size after optimization `du -hcs ${repo} | grep 'total\|итого'`" && echo
cd ${current_dir}
done
@kas-cor
kas-cor / remove_all_branches_except_master.sh
Last active August 5, 2021 17:32
Git remove all branches except master
# Удалить все ветки кроме master
git checkout master && git branch | grep -v "* master" | xargs git branch -D
@kas-cor
kas-cor / script_cookies_agree.js
Last active April 21, 2021 12:11
Cookies agree for sites | Плашка для принятия обработки кукисов.
$(function () {
if (!$.cookie('cookies_agree')) {
$("body").append([
'<div class="cookies_agree">',
'<div style="width: 80%; text-align: center; padding: 10px;">',
'Продолжая работу с ' + location.hostname + ', Вы подтверждаете использование сайтом cookies Вашего ',
'браузера с целью улучшить предложения и сервис на основе Ваших предпочтений и интересов.',
'</div>',
'<div style="width: 20%; text-align: center; padding: 10px;">',
'<button type="button" style="padding: 5px;">Понятно</button>',