Skip to content

Instantly share code, notes, and snippets.

View defun99's full-sized avatar
👾
こんにちは世界

Nikita Rychagov defun99

👾
こんにちは世界
View GitHub Profile
@defun99
defun99 / timeout.js
Created January 25, 2021 12:21 — forked from simonrenoult/timeout.js
Managing timeout. Especially handy with autocomplete.
// Props to : http://nathanleclaire.com/blog/2013/11/16/the-javascript-question-i-bombed-in-an-interview-with-a-y-combinator-startup/
var processOnTime = function ( next, delay ) {
var d = delay;
if ( ! next ) {
throw new ReferenceError();
}
if ( ! d || isNaN ( d ) ) {
d = 200;
@defun99
defun99 / timeout.js
Created January 25, 2021 12:21 — forked from simonrenoult/timeout.js
Managing timeout. Especially handy with autocomplete.
// Props to : http://nathanleclaire.com/blog/2013/11/16/the-javascript-question-i-bombed-in-an-interview-with-a-y-combinator-startup/
var processOnTime = function ( next, delay ) {
var d = delay;
if ( ! next ) {
throw new ReferenceError();
}
if ( ! d || isNaN ( d ) ) {
d = 200;
@defun99
defun99 / timeout.js
Created January 25, 2021 12:21 — forked from simonrenoult/timeout.js
Managing timeout. Especially handy with autocomplete.
// Props to : http://nathanleclaire.com/blog/2013/11/16/the-javascript-question-i-bombed-in-an-interview-with-a-y-combinator-startup/
var processOnTime = function ( next, delay ) {
var d = delay;
if ( ! next ) {
throw new ReferenceError();
}
if ( ! d || isNaN ( d ) ) {
d = 200;
const result = await axios({
method: 'post',
url: 'https://translation.googleapis.com/language/translate/v2/detect?key=AIzaSyAM0buje-vXIwgvH48sASmZDI-Jb4lMXMY',
data: {data},
headers: {'Content-Type': 'application/json'}
});
// result.data contains response
@defun99
defun99 / docker_in_venv.md
Last active September 29, 2020 14:40
Add group docker to venv and user to this group
  sudo gpasswd -a $USER docker

  newgrp docker
@defun99
defun99 / copy_collection.txt
Created September 11, 2020 10:53
Copy collection to another db (Mongo)
db.getCollection('col').find({}).forEach(function(d){ db.getSiblingDB('destinationDB')['col'].insert(d); });
@defun99
defun99 / gist:b0dff3a7b879050a365c742923ea7132
Created September 2, 2020 13:01
Freeing localhost port
1. Get process pid:
sudo lsof -iTCP:3004 -sTCP:LISTEN
2. sudo kill -9 <pid>
@defun99
defun99 / gist:3e7ba80de76c1a0ba100ee17fe015850
Created August 27, 2020 13:49
Business logic definition
>Business logic is the weird flows and rules that only make sense in the context of the user’s business
@defun99
defun99 / gist:1a5c40aed2d09db67ec79a8396a7d9a9
Last active August 4, 2020 17:56
Linux setup no password sudo actions
At the end of the /etc/sudoers file add this line:
username ALL=(ALL) NOPASSWD:ALL
Increase amount of node watches
echo fs.inotify.max_user_watches=582222 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
{"lastUpload":"2021-05-17T11:47:38.662Z","extensionVersion":"v3.4.3"}