Skip to content

Instantly share code, notes, and snippets.

View akhilome's full-sized avatar
🌚
poupon

Kizito Akhilome akhilome

🌚
poupon
View GitHub Profile
@akhilome
akhilome / get-github-ssh.md
Last active September 5, 2019 12:21
Generate and add github ssh to linux machine

First run ...

ssh-keygen -t rsa -b 4096 -C 'email@domain.com'

... from terminal, then run ...

eval "$(ssh-agent -s)"
@akhilome
akhilome / postgres10-ubuntu.md
Last active September 29, 2018 19:59
How to install and work with Postgresql 10 via psql shell on Ubuntu

Installing PostgreSQL 10 on Ubuntu

last tested on Xenial Xerus(16.04)

First add the postgresql repo to PC's sources list...

echo 'deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main' | sudo tee -a /etc/apt/sources.list.d/test.list > /dev/null
@akhilome
akhilome / recursiveStripper.js
Created August 17, 2018 18:03
Recursively remove punctuation from end of words in Javascript
function stripWords(word) {
if(/[a-z]/.test(word[word.length - 1])) {
return word;
} else {
return stripWords(word.substring(0, word.length - 1));
}
}
function duplicateCount(text) {
const tracker = {};
const dupes = [];
for (const char of text.toLowerCase()) {
if (tracker.hasOwnProperty(char)) {
tracker[char]++;
} else {
tracker[char] = 1;
}
function duplicateCount(text) {
if (!text) return 0; // no need moving forward if input is empty
const tracker = new Set(); // keep track of all characters in the input
const dupes = new Set(); // keep track of duplicate characters
for (const char of text.toLowerCase()) {
if(tracker.has(char)) {
dupes.add(char);
} else {