Skip to content

Instantly share code, notes, and snippets.

View alexsc6955's full-sized avatar
馃彔
Working from home

Santiago alexsc6955

馃彔
Working from home
View GitHub Profile
@alexsc6955
alexsc6955 / generateRandomString.js
Last active November 7, 2022 17:10
Generates a random string with a given lenth
/**
* Generate a random string with a given lenth
*
* @author <@thehomelessdev>
* @version 1.0.1
*
* @example
* // returns ten random characters including numbers and special characters
* generateRandomString(10, { includeSpecialCharacters: true })
*
@alexsc6955
alexsc6955 / replaceBrackets.js
Created October 8, 2021 18:12
Async function to replace words between brackets
/**
* Async function to replace words between brackets
*
* E.g.
* replaceBrackets(
* "Hey, {{ name }}. We just sent your authentication code to {{ email||phoneNumber }}",
* {
* name: "Jhon Doe",
* email: "[email protected]"
* }
@alexsc6955
alexsc6955 / tweet.py
Last active January 4, 2022 00:03
Tweet using tweepy
import tweepy
# You can get this credentials from your tweeter developer account
consumer_key = 'xxxxxxxxxxxxxxxxx'
consumer_secret = 'xxxxxxxxxxxxxxxxxxx'
key = 'xxxxxxxxxxxxxx-xxxxxxxxxxxxx'
secret = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
try:
@alexsc6955
alexsc6955 / binary_search.py
Created June 5, 2023 22:32
Binary search algorithm use cases
import random
import timeit
from typing import List, Optional
import unittest
# simple binary search algrothim. requires a sorted list function
def binary_search(sorted_list: List[str], target: str) -> Optional[int]:
left, right = 0, len(sorted_list) - 1
while left <= right: