Skip to content

Instantly share code, notes, and snippets.

View miry's full-sized avatar

Michael Nikitochkin miry

View GitHub Profile
@miry
miry / git_custom.plugin.zsh
Last active October 13, 2015 11:27
Custom Zsh plugins
# Git
alias g="git"
# If your branch named like [issue_number]_some_description
gh_issue() {
ghissue=`echo $(current_branch) | sed -e 's/\([0-9]*\).*/\1/'`
if [ $ghissue ]; then
echo "$ghissue"
fi
}
/ip dns static add address=127.0.0.1 ttl=600w name=".*\\.vk\\.com"
/ip dns static add address=127.0.0.1 ttl=600w name="rs.mailer.ru"
/ip dns static add address=127.0.0.1 ttl=600w name="googleads.g.doubleclick.net"
/ip dns static add address=127.0.0.1 ttl=600w name="pagead2.googlesyndication.com"
/ip dns static add address=127.0.0.1 ttl=600w name="www.googletagservices.com"
/ip dns static add address=127.0.0.1 ttl=600w name="a.pr.dotua.org"
/ip dns static add address=127.0.0.1 ttl=600w name="google-analytics.com"
/ip dns static add address=127.0.0.1 ttl=600w name=".*\\.google-analytics\\.com"
/ip dns static add address=127.0.0.1 ttl=600w name="mc.yandex.ru"
/ip dns static add address=127.0.0.1 ttl=600w name="share.yandex.ru"
@miry
miry / ssh-github-authorized-keys.sh
Last active June 1, 2018 14:27
Import Github public keys.
# Updated 2017.07.05 Thanks to https://www.reddit.com/user/xeoomd for the url
# from comment https://www.reddit.com/r/devops/comments/6l6uhm/ubuntu_server_1606_on_raspberry_pi_3_via_terraform/djsf1ai/
# Replace GTIHUB_USER with your username in Github
curl -s https://github.com/GTIHUB_USER.keys >> ~/.ssh/authorized_keys
# First version
# curl -s https://api.github.com/users/GTIHUB_USER/keys | grep key | sed 's/.*"key":\s*"\([^\"]*\)"/\1/g' >> ~/.ssh/authorized_keys
@miry
miry / .zshrc
Last active October 21, 2018 09:47
My zsh config
# Path to your oh-my-zsh configuration.
export ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="aussiegeek"
# Example aliases
@miry
miry / nginx-tuning.md
Created June 26, 2019 08:23 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@barrettclark
barrettclark / Rakefile
Created January 7, 2011 17:44
Example file download rake task
require 'rake'
# http://ruby-doc.org/stdlib/libdoc/net/http/rdoc/classes/Net/HTTP.html
require 'net/http'
desc "this is a test"
task :testing_rake do
puts "Hello from rake!"
end
namespace :remote_file do
def method_one(&block)
puts "method_one"
block.call
end
def method_two(&block)
puts "method_two"
block.call
end
@alunny
alunny / file-api-sample.js
Created April 14, 2010 18:41
sample usage of the phonegap file api
var writeData = function (filename, data, callback) {
var writeOutData = function () {
var fw = new FileWriter();
fw.oncomplete = callback;
fw.onerror = function () {
alert("Failed to save update");
}
fw.writeAsText("myDir/" + filename, data);
}
@DrPsychick
DrPsychick / git-funcs.sh
Last active April 19, 2021 20:02
Simple bash functions to automate GitHub branches and pull requests
#!/bin/bash
# Workflow: create branch -> create pull request
# git-create-branch-push "issue X"
# -> make changes, commit and push
# github-branch-pr "fix: issue solved" "closes #x"
# -> creates new PR with title and body
#
# Workflow: create branch for issue -> create pull request
# github-issue-branch-push 10
@zero-master
zero-master / GDPR.md
Last active February 14, 2022 20:07
Show visitors from EU countries a page with GDPR message using Cloudflare and .htaccess