Skip to content

Instantly share code, notes, and snippets.

View vividvilla's full-sized avatar

Vivek R vividvilla

View GitHub Profile
@ajinasokan
ajinasokan / kitetickersample.html
Last active December 18, 2023 18:47
Kite Ticker Pure JS Example
<script src="ticker.js"></script>
<script>
var ticker = new KiteTicker({api_key: "api_key", access_token: "access_token"});
ticker.connect();
ticker.on("ticks", onTicks);
ticker.on("connect", subscribe);
function onTicks(ticks) {
@vividvilla
vividvilla / mailer.py
Last active August 5, 2022 20:14
Mailer - Simple Python wrapper to send email via SMTP
from smtplib import SMTP # Use this for standard SMTP protocol (port 25, no encryption)
# from smtplib import SMTP_SSL as SMTP # This invokes the secure SMTP protocol (port 465, uses SSL)
from email.mime.text import MIMEText
class Email(object):
SMTP_CONFIG = dict(
server="your_smtp_server_hostname",
username="your_smtp_server_username",
password="your_smtp_server_password"
@fgilio
fgilio / axios-catch-error.js
Last active April 11, 2024 19:02
Catch request errors with Axios
/*
* Handling Errors using async/await
* Has to be used inside an async function
*/
try {
const response = await axios.get('https://your.site/api/v1/bla/ble/bli');
// Success 🎉
console.log(response);
} catch (error) {
// Error 😨
@staltz
staltz / music.md
Last active September 29, 2023 15:42
coding music

Not for everyone. Each programmer has their own appreciation of what is good coding music.

For when I need to think deep, debug something, or design

(From most influential to least)

@knadh
knadh / zsh-elapsed-time.md
Last active May 30, 2024 12:32
Elapsed and execution time for commands in ZSH

Elapsed and execution time display for commands in ZSH

Append this to your ~/.zshrc file.

function preexec() {
 timer=$(($(date +%s%0N)/1000000))
"""
Simple Moving Average implemented using KiteConnect Python library. -- [https://kite.trade](kite.trade)
Rainmatter (c) 2016
License
-------
This GIST is licensed under the MIT License
"""
from kiteconnect import KiteConnect
@JasonKleban
JasonKleban / LiteEvent.ts
Last active January 26, 2023 06:33
TypeScript LiteEvent Events implementation
interface ILiteEvent<T> {
on(handler: { (data?: T): void }) : void;
off(handler: { (data?: T): void }) : void;
}
class LiteEvent<T> implements ILiteEvent<T> {
private handlers: { (data?: T): void; }[] = [];
public on(handler: { (data?: T): void }) : void {
this.handlers.push(handler);
@c9s
c9s / .babelrc
Last active October 21, 2023 14:04
webpack + babel + typescript + es6 - total solutions!
{
"presets": ["es2015"],
"plugins": ["transform-runtime"]
}
@ake-persson
ake-persson / gist:ca29cca70f0b458aee4d
Last active January 28, 2022 17:43
Homebrew Formula for a Go app

Homebrew Formula for a Go app

These are quick notes from making my own Formula and Tap.

Add go build script to your Git repo

gobuild.sh

#!/bin/bash
@jorinvo
jorinvo / challenge.md
Last active April 21, 2023 17:14
This is a little challenge to find out which tools programmers use to get their everyday tasks done quickly.

You got your hands on some data that was leaked from a social network and you want to help the poor people.

Luckily you know a government service to automatically block a list of credit cards.

The service is a little old school though and you have to upload a CSV file in the exact format. The upload fails if the CSV file contains invalid data.

The CSV files should have two columns, Name and Credit Card. Also, it must be named after the following pattern:

YYYYMMDD.csv.