Skip to content

Instantly share code, notes, and snippets.

@aug2uag
aug2uag / ultimate-ut-cheat-sheet.md
Created August 2, 2018 22:11 — forked from yoavniran/ultimate-ut-cheat-sheet.md
The Ultimate Unit Testing Cheat-sheet For Mocha, Chai and Sinon

The Ultimate Unit Testing Cheat-sheet

For Mocha, Chai and Sinon

using mocha/chai/sinon for node.js unit-tests? check out my utility: mocha-stirrer to easily reuse test components and mock require dependencies


@aug2uag
aug2uag / app.js
Created September 17, 2018 19:14 — forked from nuthinking/app.js
Multiple file uploads with Nodejs
var http = require("http");
var url = require("url");
var multipart = require("./multipart/multipart");
var sys = require("sys");
var fs = require("fs");
var server = http.createServer(function(req, res) {
// Simple path-based request dispatcher
switch (url.parse(req.url).pathname) {
case '/':
@aug2uag
aug2uag / gist:63a677a9ab1e4d3af21488820c1786e4
Created November 8, 2018 04:48 — forked from vekexasia/gist:2367508
Check if the user is opening the app for the first time
private Boolean firstTime = null;
/**
* Checks if the user is opening the app for the first time.
* Note that this method should be placed inside an activity and it can be called multiple times.
* @return boolean
*/
private boolean isFirstTime() {
if (firstTime == null) {
SharedPreferences mPreferences = this.getSharedPreferences("first_time", Context.MODE_PRIVATE);
firstTime = mPreferences.getBoolean("firstTime", true);
@aug2uag
aug2uag / US Zip Codes from 2013 Government Data
Created November 8, 2018 18:56 — forked from erichurst/US Zip Codes from 2013 Government Data
All US zip codes with their corresponding latitude and longitude coordinates. Comma delimited for your database goodness. Source: http://www.census.gov/geo/maps-data/data/gazetteer.html
This file has been truncated, but you can view the full file.
ZIP,LAT,LNG
00601,18.180555, -66.749961
00602,18.361945, -67.175597
00603,18.455183, -67.119887
00606,18.158345, -66.932911
00610,18.295366, -67.125135
00612,18.402253, -66.711397
00616,18.420412, -66.671979
00617,18.445147, -66.559696
00622,17.991245, -67.153993

Reset mysql root password in Mac OS:

First Stop MySQL:

  1. Go to: 'System Preferences' >> 'MySQL' and stop MySQL

OR,

  1. sudo /usr/local/mysql/support-files/mysql.server start
  2. sudo /usr/local/mysql/support-files/mysql.server stop
@aug2uag
aug2uag / singleton.go
Created November 5, 2019 08:41 — forked from adohe-zz/singleton.go
Golang singleton implementation
package singleton
import (
"sync"
)
type singleton struct {
}
var instance *singleton
@aug2uag
aug2uag / Setup & Install
Created November 5, 2019 08:45 — forked from dhavaln/Setup & Install
Setting up HAProxy on Mac OSX
Install HAProxy from Homebre:
`brew install haproxy`
For full reference:
https://serversforhackers.com/load-balancing-with-haproxy
@aug2uag
aug2uag / basic_boto_script.py
Created August 31, 2020 22:26
basic_boto_script
import io
import scp
import paramiko
import boto3
import logging
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s :: %(levelname)s :: %(message)s')
boto_logger = logging.getLogger('boto_logger')
###################### Private Stuff
@aug2uag
aug2uag / interval.py
Created November 14, 2020 07:11 — forked from bbengfort/interval.py
Run a function every n seconds using Python threading.
from threading import Timer
from functools import partial
class Interval(object):
def __init__(self, interval, function, args=[], kwargs={}):
"""
Runs the function at a specified interval with given arguments.
"""
self.interval = interval
@aug2uag
aug2uag / installing-get-on-centos.md
Last active January 17, 2021 00:58 — forked from bradlucas/installing-get-on-centos.md
Installing Geth on Centos

This document installs Go LTS (1.13) as of the time it is written

1) Install Go (Git should already be installed)

$ cd /tmp/
$ wget https://dl.google.com/go/go1.13.linux-amd64.tar.gz
$ sha256sum go1.13.linux-amd64.tar.gz  # should end with "c48e856"
$ sudo tar -C /usr/local -xzf go1.13.linux-amd64.tar.gz