Skip to content

Instantly share code, notes, and snippets.

View dimkir's full-sized avatar
🎯
Focusing

dimkir

🎯
Focusing
View GitHub Profile
@dimkir
dimkir / .screenrc
Created September 7, 2015 16:00
Minimal .screenrc for gnu-screen with status line
hardstatus alwayslastline "%H %-Lw%{= BW}%50>%n%f* %t%{-}%+Lw%<"
@dimkir
dimkir / eltool.sh
Created March 7, 2017 17:16
Tool for building dependencies for electron on Amazon Linux (and maybe on CentOS / RHEL)
#!/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 February 6, 2021 17:45
How to run nightmare on Amazon Linux

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
@dimkir
dimkir / net_pres.c
Created April 1, 2020 12:13
net_pres.c sample
#include "../net_pres.h"
#include "../net_pres_encryptionproviderapi.h"
#include "../net_pres_socketapi.h"
#include "../net_pres_transportapi.h"
#include "net_pres_local.h"
#include "string.h"
//#define NULL '\0'
NET_PRES_InternalData sNetPresData;
@dimkir
dimkir / queue.js
Created December 12, 2019 17:48
Simple Queue Implemenation in JS
// --------
// USAGE
// --------
const q = queue({
onJobComplete: ({alias, result})=>{
console.log(`Completed job ${alias} with result: `, result);
},
onJobFail: ({alias, error})=>{
console.error(`Job ${alias} had error: `, error);
}
@dimkir
dimkir / stopwords.js
Created January 10, 2019 13:29
Some stopwords from the current tokenizer
'use strict';
const system = [
'.',
's',
'm',
'v',
't',
'1',
'p',
@dimkir
dimkir / atom-amd64.deb.log
Created December 7, 2017 15:47
Github Releases Headers
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 November 17, 2017 15:28
Sheetsu Load Modifications
(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 March 13, 2017 04:36
Using NigthmareJS on AWS Lambda
'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');
<?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);