Blog

Main posts for this site
#privacy, #sec

Your router may be already hacked

Category: security

if you get the same like on the screenshot below

you should know, you are powned, at least router which throw you to internet, was hacked, and works for person who hacked it. See explanation and cure below. On this screen you can see banners with ADs over the page opened in Mobile Safari on iPhone 5, it can happen when all your http traffic goes through enemy router, and can be modified in anyway.

Read next for more explanations

First of all, it’s all about default passwords, never ever leave default setings and passwords. So let’s go to router network settings:

hacked router screenshot

The 188.93.211.116 is the enemy dns server address which route your connections to special proxy server which modified your http traffic.

After that your must check startup commands that execute when your router switches on:

hacked router startup command screenshot

As you see here, this is same IP address in this textarea with linux commands, this commands are dynamically setup dns servers on the router, and if you’re not clean it up from this place, your router will change addreses after reboot. Delete all comands, or better is change IP address on your trusted DNS server IP. If you don’t remember anything suitable address you always can set 8.8.8.8 it is The Google dns servers, and also you can use this opensource dns.

#dev, #ruby

Capistrano 3 & Rails 4

Category: howto

Hello, today i am tell you about Capistrano 3 and Rails 4 setup. For those who never heard about Capistrano, this is deployment library which can be scripted on ruby, in any ways.

First of all Gemfile:

gem 'unicorn'

gem 'capistrano'
gem 'capistrano-rvm'
gem 'capistrano-bundler'
gem 'capistrano-rails'

After that add into Capfile some require string to previous install gems:

require 'capistrano/rvm'
require 'capistrano/bundler'
require 'capistrano/rails'

Next to deploy.rb:

set :application "your_app_name"
set :repo_url "your repository url"
set :branch 

Also you need to edit deploy/production.rb to setup production server hostname . Read full article to understain the key problem and solution for it …

#dev #javascript

2048 game bot

Category: howto

Есть такая игра 2048, суть ее в том чтобы собрать квадрат 2048 из других меньших квадратов, складываются квадраты только с одинаковой цифрой 2+2, 4+4, 8+8 и т.д

Игра написана на Javascript и HTML, а это значит можно попробовать написать бота. Открыв инспектор я сразу посмотрел на структуру этих квадратов, все оказалось очень просто об этом ниже под катом.

#productivity, #osx

Продуктивное использование Mail.app

Category: howto

Привет хочу рассказать как я эффективно использую стандартный почтовый клиент Mail.app в OSX.

Когда появляется много почтовых ящиков им нужно как то эффективно управлять, желательно в одном месте. С недавних пор я перешел на довольно удобную парадигму “Unread inbox” директории в которую попадают все не прочитанные письма со всех ящиков, подробнее далее.

#admin, #linux

Apache 2.2 to 2.4 migration и remoteip модуль

Category: howto

Основное на что надо обратить внимание это директивы доступа и новый модуль remoteip который выполняет теже функции и что и знакомый всем rpaf

2.2 configuration:

Order deny,allow
Deny from all

2.4 configuration:

Require all denied

2.2 configuration:

Order Deny,Allow
Deny from all
Allow from example.org

2.4 configuration:

Require host example.org

Подробнее читайте далее

#dev, #hardware

Arduino music - проигрывание музыки на платформе Ардиуно

Category: howto

Долго лежала в тумбочке моя Arduino, преждем чем я достал ее и решил хоть что нибудь попробовать, ну и попробовал издавать с помощью нее какие нибудь звуки. Для этого я нашел какуюто старую пьезо пищалку и срочно прикрепил ее на breadboard, подключил ее к arduino написал немного кода, и вот что получилось:

В планах наверное подключить туда клавиатуру, чтобы сделать синтезатор, чтобы можно было делать chiptune

Исходники под катом и на гитхабе https://github.com/noroot/arduinostuff, код не мой, взял с гугла источник уже непомню, но код немного исправил.

Для тех кто не знает что такое Arduino, - это такая opensource hardware платформа для программирования микроконтроллеров, выглядит она так:

Файл pitches.h можно взять здесь https://github.com/noroot/arduinostuff/blob/master/lib/pitches.h

#dev, #php

how to render template into variable in ZF2

Category: howto

Следующий пример показывает как можно просто отрендерить шаблон в переменную в Zend Framework 2

<?php 
 
public function coolAction()
{
	$d = array();
	$r = new PhpRenderer();
	$resolver = new \Zend\View\Resolver\TemplateMapResolver();
 
	$resolver->setMap(array(
		'confirmation_template' => __DIR__ . '/../../../view/user/mail/confirmation.phtml' // full path to template
	));
	$r->setResolver($resolver);
	$model = new ViewModel($d);
	$model->setTemplate('confirmation_template');
	$x = $r->render($model);
}
?>
#dev, #javascript

How to define console object

Category: howto

Ситуация такая, допустим вы везде испоьзовали для отладки console.log, но потом на тестировании в разных браузерах обнаружили что console object is undefined например в IE нет никакого console object.

Этот код определяет обьект console и может быть использован для эмуляции или просто заглушки(чтобы небыло алертов об ошибках).

if (typeof(console) == 'undefined') {
    var console = {
        log: function(message) {},
        info: function(message) {},
        warn: function(message) {},
        error: function(message) {
            alert(message);
        }
    }
}
#dev, #javascript

Is touchscreen on javascript

Category: howto

Some of javascript shortcuts below here:

var is_touch_device = 'ontouchstart' in document.documentElement;
function isTouchDevice() {
    var el = document.createElement('div');
    el.setAttribute('ongesturestart', 'return;');
    return typeof el.ongesturestart === "function";
}
#dev, #php

Php strftime month name

Category: howto

Многие задаются вопросом не незнают как правильно сделать склонения дат которую выдают функция strftime(“%B”); Документация по этому вопросу ничего конкретного не говорит, и полное название месяца %B на разных системах выводится по разному

Например в OSX php 5.4.3 %B показывает полное название месяца в нужному падеже например “Августа”, при этом тот же самый код в Debian выдает “Август”, дело в том что в файлах локалях содержатся разные строки строки, в OSX со склонение , а в Debian без склонения, тем не менее это еще не вся магия дело в том что в файлах локали есть такие строки

% Initially alt_digits was supposed to hold alternative symbols for _digits_,
% corresponding to %O modified conversion specification.
% Although in Ukrainian language alternate _names_ are used instead of digits.
% We'll use this keyword to present a list of month names in proper form for
% date, see mon. (%Om)
%
% This hack is dedicated for months it won't work for other %O* modifiers
% (weeks, days etc).
%

Подробнее подкатом.