Skip to content

Instantly share code, notes, and snippets.

View EddiG's full-sized avatar
🛠️
making good stuff for good people

Eduard Gilmutdinov EddiG

🛠️
making good stuff for good people
View GitHub Profile
@EddiG
EddiG / letsencrypt-iis.md
Created May 19, 2017 16:15
How to create Let's encrypt certificate for IIS server

Let’s Encrypt certificate

For IIS

Create new certificate

certbot certonly --manual -d www.yourwebsite.com -d yourwebsite.com

Vim cheat sheet

Motions and Operators

Motions

  • [operator]aw - current word with trailing space
  • [operator]iw - current word
  • [operator]ap - current paragraph with trailing space
  • [operator]ip - current paragraph
  • [operator]l - current letter
  • [operator]it - inside the tag
  • [operator]0 - move to begin of line
@EddiG
EddiG / js-tricks.md
Last active October 26, 2022 08:20
JavaScript tricks

JavaScript Tricks (not only)

Text

In generally you should convert input string into the array, do the necessary transformation (filter, map, reduce) and join all elements into resulting string.

How to reverse a string

const input = 'reverse me'
const reversed = [...input].reverse().join('')

How to truncate long text

// based on https://gist.github.com/paulirish/12fb951a8b893a454b32
const $ = document.querySelector.bind(document);
const $$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn);
};
NodeList.prototype.__proto__ = Array.prototype; // eslint-disable-line

The default prefix is C-b
How to vertical split current pane

<prefix> %

How to horizontal split current pane

<prefix> "

How to resize current pane

@EddiG
EddiG / unpack-msg.md
Created July 3, 2017 11:12
How to unpack the MS Outlook message file

Convert from msg to eml format

sudo apt install libemail-outlook-message-perl 
msgconvert <filename>.msg

Unpack eml

sudo apt install mpack
munpack <filename>.eml

Took it from https://rekit-portal.herokuapp.com/element/src%252Findex.html/code

(function() {
  var loadingNode = document.getElementById('loading-node');
  var textNode = loadingNode.childNodes[0];
  var barNode = loadingNode.childNodes[1];
  var req = new XMLHttpRequest();

  // report progress events
  req.addEventListener('progress', function(evt) {

If the package in the node_modules directory causing the type errors when the flow doing its job

  • Add <PROJECT_ROOT>/node_modules/BADASS_PACKAGE/*. in [ignore] section of .flowconfig
  • Perform flow-typed create-stub BADASS_PACKAGE

If you don't have a flow-typed

  • Install it yarn global add flow-typed
  • [OPTIONALY] Install definitions for packages flow-typed install
@EddiG
EddiG / ELM237-Bluetooth.md
Last active September 11, 2017 04:14
How to connect to the ELM237 OBD-II adapter
hcitool scan
# 00:11:22:33:44:55
sudo rfcomm bind /dev/rfcomm0 00:11:22:33:44:55
ls -l /dev/rfcomm0
# crw-rw---- root dialout ... /dev/rfcomm0
sudo usermod -a -G dialout
# You should logout/login

For access in VirtualBox guest machine you should enable serial port, select Host Device and define the path /dev/rfcomm0 in the settings of machine.

Polyfill for localStorage in Safari private browsing mode

Inspired by https://gist.github.com/juliocesar/926500

function getLocalStorage() {
  try {
    window.localStorage.setItem('__test-localstorage__', '1');
    window.localStorage.removeItem('__test-localstorage__');
    return window.localStorage;
  } catch (error) {
 const localStorage = {