Skip to content

Instantly share code, notes, and snippets.

View miry's full-sized avatar

Michael Nikitochkin miry

View GitHub Profile
@hvoecking
hvoecking / translate.go
Last active March 28, 2024 13:52
Golang reflection: traversing arbitrary structures
// Traverses an arbitrary struct and translates all stings it encounters
//
// I haven't seen an example for reflection traversing an arbitrary struct, so
// I want to share this with you. If you encounter any bugs or want to see
// another example please comment.
//
// The MIT License (MIT)
//
// Copyright (c) 2014 Heye Vöcking
//
/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 / .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 / 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
}
@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
@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);
}