Skip to content

Instantly share code, notes, and snippets.

View m4tlch's full-sized avatar
🏠
Working from home

Paul Nike m4tlch

🏠
Working from home
  • Ukraine
View GitHub Profile
@m4tlch
m4tlch / get_token.js
Created September 28, 2017 07:39
Auth token from amo
(function(m, id, cb){
$.ajax({
method: "GET",
headers: {"X-Auth-Token": m.auth_token},
url: m.server_base + "/ui/api/v1.1/ajax/mail/attach/" + id,
success: cb
});
})(
// Объект авторизации AmoMail
AMOCRM.constant('amomail'),
@m4tlch
m4tlch / my.cnf
Created March 16, 2017 21:04 — forked from petemcw/my.cnf
Ubuntu MySQL 5.1 Configuration - 4GB RAM, Heavy InnoDB
# The MySQL database server configuration file.
#
# DESC: InnoDB mainly, heavy queries, fewer connections, 4GB RAM
#
# Remember to edit /etc/mysql/debian.cnf when changing the socket location.
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
# This was formally known as [safe_mysqld]. Both versions are currently parsed.
@m4tlch
m4tlch / html.tpl.php
Created February 9, 2017 10:18 — forked from pascalduez/html.tpl.php
Drupal 7 — Move $scripts at page bottom
<!DOCTYPE html>
<html<?php print $html_attributes; ?>>
<head>
<?php print $head; ?>
<title><?php print $head_title; ?></title>
<?php print $styles; ?>
<?php print $head_scripts; ?>
</head>
<body<?php print $body_attributes;?>>
@m4tlch
m4tlch / nginx-tuning.md
Created February 5, 2017 22:34 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

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.

@m4tlch
m4tlch / 00.howto_install_phantomjs.md
Created December 9, 2016 11:01 — forked from julionc/00.howto_install_phantomjs.md
How to install PhantomJS on Debian/Ubuntu

How to install PhantomJS on Ubuntu

Version: 1.9.8

Platform: x86_64

First, install or update to the latest system software.

sudo apt-get update
sudo apt-get install build-essential chrpath libssl-dev libxft-dev
write to /etc/httpd/conf/extra
<Directory /var/www/html>
Options Indexes FollowSymLinks MultiViews
Require all granted
AllowOverride All
</Directory>
<?php
/***************************************************************************\
| Sypex Dumper version 2.0.11 |
| (c) 2003-2011 zapimir zapimir@zapimir.net http://sypex.net/ |
| (c) 2005-2011 BINOVATOR info@sypex.net |
|---------------------------------------------------------------------------|
| created: 2003.09.02 19:07 modified: 2013.08.27 06:27 |
|---------------------------------------------------------------------------|
| Sypex Dumper is released under the terms of the BSD license |
# Path to your oh-my-zsh installation.
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="bira"
# Uncomment the following line to use case-sensitive completion.
@m4tlch
m4tlch / visor-archivos-online.md
Created June 7, 2016 07:19 — forked from izazueta/visor-archivos-online.md
Google Docs Viewer & Office Web Apps Viewer

Google Docs Viewer

Only files under 25 MB can be previewed with the Google Drive viewer.

Google Drive viewer helps you preview over 16 different file types, listed below:

  • Image files (.JPEG, .PNG, .GIF, .TIFF, .BMP)
  • Video files (WebM, .MPEG4, .3GPP, .MOV, .AVI, .MPEGPS, .WMV, .FLV)
  • Text files (.TXT)
  • Markup/Code (.CSS, .HTML, .PHP, .C, .CPP, .H, .HPP, .JS)
  • Microsoft Word (.DOC and .DOCX)
function mymodule_user_login_credentials($username, $password)
{
if($uid = user_authenticate($username, $password))
{
user_login_submit(array(), array('uid' => $uid));
return true;
}
else
{
return false;