Skip to content

Instantly share code, notes, and snippets.

View ultim8k's full-sized avatar
🛠️
Rock & roll!

Kostas Kapenekakis ultim8k

🛠️
Rock & roll!
View GitHub Profile
@ultim8k
ultim8k / kill-process-running-on-specific-port.md
Created September 16, 2019 11:07
Killing process that listens to a specific port

Killing process that listens to a specific port

Find the process that listens on a port

Copied from: stackoverflow

Our example port is 3000. Replace it with the port number you need.

@ultim8k
ultim8k / clean_remotelly_deleted_git_branches.sh
Created September 1, 2019 18:03
Deletes local git branches which have been deleted on the remote host
git fetch -p && for branch in `git branch -vv | grep ': gone]' | awk '{print $1}'`; do git branch -D $branch; done
@ultim8k
ultim8k / pubNameGenerator.js
Last active March 24, 2021 11:11
Pub Name Generator
/*
* pubNameGenerator
*
* Copied parts from: https://github.com/pablorecio/pubnamegenerator
* License: MIT
*
*/
const THINGS = [
"Albion",

Commit Message Guidelines

Short (72 chars or less) summary

More detailed explanatory text. Wrap it to 72 characters. The blank
line separating the summary from the body is critical (unless you omit
the body entirely).

Write your commit message in the imperative: "Fix bug" and not "Fixed
bug" or "Fixes bug." This convention matches up with commit messages
@ultim8k
ultim8k / README.md
Last active January 31, 2019 14:37
Increase file upload size limit in PHP-Nginx
@ultim8k
ultim8k / zero_sum_array.js
Created November 24, 2018 00:22
Create array of (n) items that their sum is 0
// var n = 6;
// var ppp = new Array(n).fill(0).map((_, i) =>
// n % 2 // if n is odd
// ? i === 0 // if index is 0
// ? 0 // return 0
// : i % 2 // if index is odd
// ? i + 1 // return index + 1
// : - i // return - index
// : i % 2 // if index is odd
// ? - i // return - index
@ultim8k
ultim8k / quickReverse.js
Last active September 18, 2018 23:42
Reverse an array fast by "folding" it and counting until the middle.
// This son of a bitch goes until the middle of the array
// and flips each item with it's mirrored item from the end
let arr = [1, 7, 2, 5, 9];
const halfLength = arr.length / 2;
const maxI = arr.length - 1;
for (let i = 0; i <= parseInt(halfLength); i=i+1) {
let m = maxI - i;
let a = arr[i];
let b = arr[m];
@ultim8k
ultim8k / README.md
Created September 13, 2018 20:56
So much for the sea shells

Count lines of this file

cat ./README.md | wc -l

Convert input from standard input into arguments to a command

@ultim8k
ultim8k / delete-values-from-array.js
Last active September 12, 2018 10:44
delete values from array | not optimised - who cares
var valuesToBeDeleted = [1, 5, 7, 15];
var mixedValues = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20];
// Boring solution:
valuesToBeDeleted.forEach(item => {
var itemIndex = mixedValues.indexOf(item);
mixedValues.splice(itemIndex, 1);
});
// Better solution: