Skip to content

Instantly share code, notes, and snippets.

View harshitanand's full-sized avatar
🏠
Working from home

Harshit Anand harshitanand

🏠
Working from home
  • Bangalore, India
View GitHub Profile
anonymous
anonymous / bonfire-validate-us-telephone-numbers.js
Created December 4, 2015 17:28
http://www.freecodecamp.com/harshitanand 's solution for Bonfire: Validate US Telephone Numbers
// Bonfire: Validate US Telephone Numbers
// Author: @harshitanand
// Challenge: http://www.freecodecamp.com/challenges/bonfire-validate-us-telephone-numbers
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function telephoneCheck(str) {
// Good luck!
var re = /^(?:(?:\+?1\s*(?:[.-]\s*)?)?(?:\(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\s*\)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*(?:[.-]\s*)?)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\s*(?:[.-]\s*)?([0-9]{4})$/;
return re.test(str);
anonymous
anonymous / bonfire-where-art-thou.js
Created December 4, 2015 09:48
http://www.freecodecamp.com/harshitanand 's solution for Bonfire: Where art thou
// Bonfire: Where art thou
// Author: @harshitanand
// Challenge: http://www.freecodecamp.com/challenges/bonfire-where-art-thou
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function isSuper(a,b){
var l=b.length,i=0,c;
if(l>a.length){return false;}
else{
for(i;i<l;i++){
anonymous
anonymous / bonfire-convert-html-entities.js
Created December 4, 2015 08:53
http://www.freecodecamp.com/harshitanand 's solution for Bonfire: Convert HTML Entities
// Bonfire: Convert HTML Entities
// Author: @harshitanand
// Challenge: http://www.freecodecamp.com/challenges/bonfire-convert-html-entities
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function convert(str) {
// :)
str = str.replace(/[&|<|>|'|"]/gi, function(a) {
switch (a) {
case '&':
@res0nat0r
res0nat0r / create-aws-console-user.sh
Created October 7, 2015 16:00 — forked from stefhen/create-aws-console-user.sh
Create AWS console user from the awscli
#!/bin/bash
# USAGE: ./create-aws-console-user.sh $GROUPNAME $USERNAME $PASSWORD
# http://docs.aws.amazon.com/IAM/latest/UserGuide/id_users_create.html#id_users_create_cliwpsapi
# Create administrator group
aws iam create-group --group-name $1
@harshitanand
harshitanand / Random Quote Machine.markdown
Created September 19, 2015 14:04
Random Quote Machine
@kageurufu
kageurufu / lambda.js
Last active November 25, 2021 12:44
AWS Lambda Thumbnailer
var async = require("async");
var AWS = require("aws-sdk");
var gm = require("gm").subClass({imageMagick: true});
var fs = require("fs");
var mktemp = require("mktemp");
var THUMB_KEY_PREFIX = "thumbnails/",
THUMB_WIDTH = 150,
THUMB_HEIGHT = 150,
ALLOWED_FILETYPES = ['png', 'jpg', 'jpeg', 'bmp', 'tiff', 'pdf', 'gif'];
@linhmtran168
linhmtran168 / pre-commit-eslint
Last active July 6, 2025 08:17
Pre-commit hook to check for Javascript using ESLint
#!/bin/sh
STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep ".jsx\{0,1\}$")
if [[ "$STAGED_FILES" = "" ]]; then
exit 0
fi
PASS=true
@matthewdfuller
matthewdfuller / awsDownloadFilesInBucket.js
Created March 20, 2015 19:36
List and download all files in a given S3 bucket
/* Installation:
* npm install aws-sdk
* npm install async
* node awsDownloadFilesInBucket.js
*/
// SETTINGS
var AWS_KEY = '';
var AWS_SECRET = '';
var BUCKET = '';
@bonzanini
bonzanini / create_index.sh
Last active May 25, 2023 23:35
Elasticsearch/Python test
curl -XPOST http://localhost:9200/test/articles/1 -d '{
"content": "The quick brown fox"
}'
curl -XPOST http://localhost:9200/test/articles/2 -d '{
"content": "What does the fox say?"
}'
curl -XPOST http://localhost:9200/test/articles/3 -d '{
"content": "The quick brown fox jumped over the lazy dog"
}'
curl -XPOST http://localhost:9200/test/articles/4 -d '{
@jctosta
jctosta / screen_cheatsheet.markdown
Last active July 10, 2025 12:12
Screen Cheatsheet

Screen Quick Reference

Basic

Description Command
Start a new session with session name screen -S <session_name>
List running sessions / screens screen -ls
Attach to a running session screen -x
Attach to a running session with name screen -r