Skip to content

Instantly share code, notes, and snippets.

View naveenwashere's full-sized avatar
🎯
Focusing

Naveen Kumar K naveenwashere

🎯
Focusing
View GitHub Profile
@justmoon
justmoon / custom-error.js
Last active April 22, 2024 17:19 — forked from subfuzion/error.md
Creating custom Error classes in Node.js
'use strict';
module.exports = function CustomError(message, extra) {
Error.captureStackTrace(this, this.constructor);
this.name = this.constructor.name;
this.message = message;
this.extra = extra;
};
require('util').inherits(module.exports, Error);
@giwa
giwa / file0.txt
Last active March 27, 2020 11:31
Install hive on Mac with Homebrew ref: http://qiita.com/giwa/items/dabf0bb21ae242532423
$ brew update
$ brew install hive
@RobertFischer
RobertFischer / Retry.java
Last active July 25, 2020 22:12
A utility method for retrying on exception, using Java 8 lambdas
public class Retry {
private static final Logger log = Logger.getLogger(Retry.class);
public static interface CallToRetry<T> {
<T> T doIt() throws Exception;
}
public static T withRetry(int maxTimes, long initialWait, int waitMultiplier, CallToRetry<T> call) {
if(maxTimes <= 0) {
@benlinton
benlinton / multiple_mysql_versions_for_development.md
Last active September 23, 2023 09:38
Multiple MySQL Versions with Homebrew

Multiple MySQL Versions for Development

Options included below:

  • Using Docker docker-compose
  • Using Homebrew brew

Using Docker (recommended)

This gist was originally created for Homebrew before the rise of Docker, yet it may be best to avoid installing mysql via brew any longer. Instead consider adding a barebones docker-compose.yml for each project and run docker-compose up to start each project's mysql service.

@application2000
application2000 / how-to-install-latest-gcc-on-ubuntu-lts.txt
Last active May 7, 2024 10:38
How to install latest gcc on Ubuntu LTS (12.04, 14.04, 16.04)
These commands are based on a askubuntu answer http://askubuntu.com/a/581497
To install gcc-6 (gcc-6.1.1), I had to do more stuff as shown below.
USE THOSE COMMANDS AT YOUR OWN RISK. I SHALL NOT BE RESPONSIBLE FOR ANYTHING.
ABSOLUTELY NO WARRANTY.
If you are still reading let's carry on with the code.
sudo apt-get update && \
sudo apt-get install build-essential software-properties-common -y && \
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && \
@iRbouh
iRbouh / UseAutoIncrementID.php
Last active December 20, 2022 02:26
Auto incrementing sequence Trait to use with jenssegers/laravel-mongodb for AI MySQL-like IDs
<?php
namespace App\Traits;
trait UseAutoIncrementID {
/**
* Increment the counter and get the next sequence
*
* @param $collection
@Shellbye
Shellbye / ubuntu_spark_installer.sh
Last active October 9, 2018 07:58
Install spark 2.1.0 on ubuntu
sudo wget http://d3kbcqa49mib13.cloudfront.net/spark-2.1.0-bin-hadoop2.7.tgz
sudo tar -zxvf spark-2.1.0-bin-hadoop2.7.tgz
cd spark-2.1.0-bin-hadoop2.7
sudo cp conf/log4j.properties.template conf/log4j.properties
sudo sed -i -e 's/INFO/WARN/g' conf/log4j.properties
sudo cp conf/spark-env.sh.template conf/spark-env.sh
sudo cp conf/slaves.template conf/slaves
@GLMeece
GLMeece / latency_numbers.md
Last active April 29, 2024 09:47
Latency Numbers Every Programmer Should Know - MarkDown Fork

Latency Comparison Numbers

Note: "Forked" from Latency Numbers Every Programmer Should Know

Event Nanoseconds Microseconds Milliseconds Comparison
L1 cache reference 0.5 - - -
Branch mispredict 5.0 - - -
L2 cache reference 7.0 - - 14x L1 cache
Mutex lock/unlock 25.0 - - -
@gandarez
gandarez / BinaryTreeFindLongestZigZag.cs
Created March 9, 2017 01:10
Find the longest zigzag from a binary tree
class Tree
{
public int x;
public Tree l;
public Tree r;
};
class Task3
{
public int solution(Tree T)
@martinwicke
martinwicke / automobile.ipynb
Last active January 9, 2022 08:14
Estimator demo using Automobile dataset
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.