Skip to content

Instantly share code, notes, and snippets.

View nikeshashar's full-sized avatar

Nikesh Ashar nikeshashar

  • Cledara
  • London
View GitHub Profile
@nikeshashar
nikeshashar / domainextract
Created December 15, 2022 23:04
Extract just the domain from a url in Google Sheets
`=IFERROR(TRIM(REGEXEXTRACT(C2,"@([^\.]+)")))`
#!/bin/zsh
# Disk percentage usage to alert on, 90 is 90% used
targetFreeSpace=90
diskPercentageUsed=$( /bin/df -H | /usr/bin/awk '/\/dev\/disk1s1/ {print $5}' | /usr/bin/tr -d '%')
echo "Disk percent used: $diskPercentageUsed"
if [ "$diskPercentageUsed" -gt "$targetFreeSpace" ]; then
exit 1
else
exit 0
fi
@nikeshashar
nikeshashar / update_clone_fork.md
Created September 25, 2017 16:08
How to update your Github fork

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream

Example for single line:

single line code

Example for multiline (code block):

multi line
markdown
[1, 2, 3].map(function(number) {
return number * 3;
}
// => [3, 6, 9]
[1, 2, 3].map { |number| number * 3 }
#=> [3, 6, 9]
Failures:
1) AceCard possible_scores returns low and high scores
Failure/Error:
expect(described_class.new(:ace).possible_scores)
.to eq([1, 11])
expected: [1, 11]
got: [1, 10]
{
"scripts": {
"start": "node ./bin/www"
}
}
{
"development": {
"username": null,
"password": null,
"database": "my_app_development",
"host": "127.0.0.1",
"dialect": "postgres"
},
"test": {
"username": null,
// bin/www
var models = require('../models');