Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

dimkir

🎯
Focusing
Block or report user

Report or block dimkir

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@dimkir
dimkir / stopwords.js
Created Jan 10, 2019
Some stopwords from the current tokenizer
View stopwords.js
'use strict';
const system = [
'.',
's',
'm',
'v',
't',
'1',
'p',
@dimkir
dimkir / atom-amd64.deb.log
Created Dec 7, 2017
Github Releases Headers
View atom-amd64.deb.log
curl -I https://github.com/atom/atom/releases/download/v1.23.0-beta1/atom-amd64.deb
HTTP/1.1 302 Found
Server: GitHub.com
Date: Thu, 07 Dec 2017 14:51:51 GMT
Content-Type: text/html; charset=utf-8
Status: 302 Found
Cache-Control: no-cache
Vary: X-PJAX
Location: https://github-production-release-asset-2e65be.s3.amazonaws.com/3228505/c184cdd4-c9eb-11e7-8f48-deb22c42821f?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20171207%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20171207T145151Z&X-Amz-Expires=300&X-Amz-Signature=18f616b2575741f067ca2e8932140ca5f78dd9f975be4b15d10b1dc133b8bcb0&X-Amz-SignedHeaders=host&actor_id=0&response-content-disposition=attachment%3B%20filename%3Datom-amd64.deb&response-content-type=application%2Foctet-stream
@dimkir
dimkir / load-sheetsu-com.js
Last active Nov 17, 2017
Sheetsu Load Modifications
View load-sheetsu-com.js
(function(){
var utils = {
startsWith : function (s, e, t) {
return t = t || 0, s.indexOf(e, t) === t
}
};
function callable__TriggerSheetsu_Request_and_Attach_EventDataReceived(element_with_sheetsu_attr) {
var el = element_with_sheetsu_attr;
@dimkir
dimkir / index.js
Created Mar 13, 2017
Using NigthmareJS on AWS Lambda
View index.js
'use strict';
// Code in global scope (outside of event) runs once, when container is first created
var pack = require('./lib/nightmare-lambda-pack');
var electronPath = pack.installNightmare(); // this will install the electron on the Lambda
var Xvfb = require('./lib/xvfb');
@dimkir
dimkir / eltool.sh
Created Mar 7, 2017
Tool for building dependencies for electron on Amazon Linux (and maybe on CentOS / RHEL)
View eltool.sh
#!/bin/bash
DIST_DEPS=0
CENTOS_DEPS=0
GCONF_COMPILE=0
GCONF_INSTALL=0
PIXBUF_INSTALL=0
PIXBUF_COMPILE=0
@dimkir
dimkir / nightmare-on-amazon-linux.MD
Last active Oct 2, 2019
How to run nightmare on Amazon Linux
View nightmare-on-amazon-linux.MD

Running nightmare on Amazon Linux

You may have thought of running nightmare on AWS Lambda. But before we can run it on Lambda, we need first to make it run on Amazon Linux.

Provision instance which replicates Lambda environment

According to AWS Documentation on Lambda Execution Environment and available Libraries we would need this AMI image with this alias amzn-ami-hvm-2016.03.3.x86_64-gp2. Keep in mind that AMI-image-id for this instance would be different in different regions (eg):

  • In eu-west-1 - ami-f9dd458a
  • In us-east-1 - ami-6869aa05
View gist:eb46a7e57a389ac9d2cdbc2762abfdf3
<?php
use Respect\Validation\Validator as v;
/**
*
* @throws \Respect\Validation\Exceptions\ValidationException (actually superclass of \InvalidArgumentException)
*/
function createUserEntity($username, $firstName, $lastName, $age, $heightCm, $married, $email, $comment){
v::alnum()->noWhitespace()->length(1,15)->check($username);
@dimkir
dimkir / CategoryRepository2.php
Last active Feb 4, 2016
Two queries to fetch Category and sliced relationship
View CategoryRepository2.php
<?php
namespace AppBundle\Repository;
use AppBundle\Entity\Category;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\Tools\Pagination\Paginator;
@dimkir
dimkir / CategoryRepository.php
Created Feb 3, 2016
Attempt to limit quantity of loaded relationships (eg. only load 5 presentations with the Category)
View CategoryRepository.php
<?php
namespace AppBundle\Repository;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\Tools\Pagination\Paginator;
class CategoryRepository extends EntityRepository
@dimkir
dimkir / UpdateCommand.php
Created Jan 12, 2016
Modified to format and syntax highlight sql statements
View UpdateCommand.php
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
You can’t perform that action at this time.