Skip to content

Instantly share code, notes, and snippets.

View RANUX's full-sized avatar
🏠
👉JavaScript dev. Open for job offerings

Alexander RANUX

🏠
👉JavaScript dev. Open for job offerings
View GitHub Profile
@RANUX
RANUX / restart-nodebb.py
Last active August 8, 2016 11:22
Restart nodebb if 504 bad gateway error
#!/usr/bin/python
import requests
import subprocess
import time, signal, logging
import os
logging.basicConfig(level=logging.INFO)
cur_dir = os.path.dirname(os.path.abspath(__file__))
nodebb_path = os.path.join(cur_dir, 'nodebb')
@RANUX
RANUX / parse-moscow-areas-table.js
Last active July 23, 2016 22:54
Парсинг списка мунициальных районов Москвы
/* Отркойте
* https://ru.wikipedia.org/wiki/Список_районов_и_муниципальных_образований_Москвы
* и вставте код в отладочную консоль браузера (chrome, opera или firefox)
*/
var areas = [];
$('table>tbody>tr>td:nth-child(2)>a').each(function(index){
areas.push($(this).text().toLowerCase().split(' ').join('').split('-').join(''));
});
console.log(areas);
@RANUX
RANUX / parse-ul-li-table.js
Created July 23, 2016 09:51
JQuery parse ul li table and count stats
var items = [];
$('.history-table>ul>li>.td-likes').each(function(item) {
// clean spaces
var itemText = $(this).text().replace(/\s+/g, ' ');
itemText = itemText.replace(/^0\s$/g, '').split(/\s/g,2);
var num = parseInt(itemText);
if (num && !isNaN(num))
items.push(num);
});
@RANUX
RANUX / webstame-get-top-tags.js
Created July 22, 2016 22:56
Get top tags from websta.me
// open browser debug console, paste code and run
var links = $('.tagname>a');
var a = [];
for ( var i=0; i < links.length; i++ )
{
a.push( $(links[i]).text() );
}
@RANUX
RANUX / комбинации-клавиш-bash.txt
Last active April 10, 2025 18:42
Комбинации клавиш для Bash
##### Перемещение курсора:
Ctrl + a — переход в начало строки
Ctrl + b — переход на 1 символ назад
Ctrl + c — посылает программе SIGINT. Обычно, прерывает текущее задание
Ctrl + d — удаляет символ под курсором (аналог delete)
Ctrl + e — переход к концу строки
Ctrl + f — переход на 1 символ вперёд
Ctrl + xx — переходит от текущей позиции курса в начало строки и обратно.
Ctrl + p — Предыдущая команда (Стрелка вверх)
@RANUX
RANUX / vim_cheatsheet.md
Created July 22, 2016 13:03 — forked from awidegreen/vim_cheatsheet.md
Vim shortcuts

Introduction

  • C-a == Ctrl-a
  • M-a == Alt-a

General

:q        close
:w        write/saves
:wa[!]    write/save all windows [force]
:wq       write/save and close
@RANUX
RANUX / bashkeys.sh
Created July 22, 2016 13:00
Bash keyboard shortcuts script
#!/bin/bash
# Copy this script to /usr/local/bin or to any bin folder you like. Make executable and use it.
# cp bashkeys.sh /usr/local/bin
# cmod 755 /usr/local/bin/bashkeys.sh
# bashkeys.sh
echo '
Bash Keyboard Shortcuts
Moving the cursor:
@RANUX
RANUX / bash_keyboard_shortcuts.txt
Created July 22, 2016 12:29
Bash Keyboard Shortcuts
Bash Keyboard Shortcuts
Moving the cursor:
Ctrl + a Go to the beginning of the line (Home)
Ctrl + e Go to the End of the line (End)
Ctrl + p Previous command (Up arrow)
Ctrl + n Next command (Down arrow)
Alt + b Back (left) one word
Alt + f Forward (right) one word
@RANUX
RANUX / docker_cheat.md
Created July 18, 2016 15:35 — forked from wsargent/docker_cheat.md
Docker cheat sheet
@RANUX
RANUX / recursion-examples.js
Last active March 5, 2016 13:49
Simple recursion examples on javascript
// factorials
function factorial(n) {
if ( n == 0 ) return 1;
return n * factorial( n - 1 );
}
// triangle numbers
function triangle(n) {
if ( n == 1 ) return 1;
return n + triangle(n-1);
}