Skip to content

Instantly share code, notes, and snippets.

View aug2uag's full-sized avatar

Reza Fatahi aug2uag

  • Los Angeles, CA
View GitHub Profile
@thornbill
thornbill / .gitlab-ci.yml
Created November 22, 2016 21:29
Example Node GitLab CI Yamlfile
# Official framework image. Look for the different tagged releases at:
# https://hub.docker.com/r/library/node/tags/
image: node:6
before_script:
- npm install
# This folder is cached between builds
# http://docs.gitlab.com/ce/ci/yaml/README.html#cache
cache:
@dhavaln
dhavaln / Setup & Install
Last active October 10, 2023 13:49
Setting up HAProxy on Mac OSX
Install HAProxy from Homebre:
`brew install haproxy`
For full reference:
https://serversforhackers.com/load-balancing-with-haproxy
@josh-authy
josh-authy / hmac-verification.js
Last active August 13, 2017 14:45
HMAC Verification with Node.js
var qs = require('qs');
var crypto = require('crypto');
/**
* @param {http request} req
* @param {!string} apiKey
* @return {Boolean} True if verified
*/
function verifyCallback(req, apiKey) {
@hollance
hollance / neural.c
Last active April 21, 2023 17:13
Playing with BNNS on macOS 10.12. The "hello world" of neural networks.
/*
The "hello world" of neural networks: a simple 3-layer feed-forward
network that implements an XOR logic gate.
The first layer is the input layer. It has two neurons a and b, which
are the two inputs to the XOR gate.
The middle layer is the hidden layer. This has two neurons h1, h2 that
will learn what it means to be an XOR gate.
@adohe-zz
adohe-zz / singleton.go
Created April 29, 2016 08:01
Golang singleton implementation
package singleton
import (
"sync"
)
type singleton struct {
}
var instance *singleton
@bbengfort
bbengfort / interval.py
Last active July 7, 2023 04:33
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
@patrickbrandt
patrickbrandt / socket.io_Express_Angular.md
Last active August 30, 2023 21:28
Simple socket.io integration with Express + Angular

Socket.io integration between an Express and Angular app is a breeze. I'll outline the Express implementation first, then outline Angular integration.

Express + socket.io

Reference socket.io in layout.jade

npm install socket.io --save and then reference socket.io in your layout.jade file:

doctype html
html(ng-app="example")
  head
    title= title
@yoavniran
yoavniran / ultimate-ut-cheat-sheet.md
Last active June 1, 2024 09:44
The Ultimate Unit Testing Cheat-sheet For Mocha, Chai, Sinon, and Jest
@vitorbritto
vitorbritto / rm_mysql.md
Last active May 20, 2024 19:44
Remove MySQL completely from Mac OSX

Remove MySQL completely

  1. Open the Terminal

  2. Use mysqldump to backup your databases

  3. Check for MySQL processes with: ps -ax | grep mysql

  4. Stop and kill any MySQL processes

  5. Analyze MySQL on HomeBrew:

    brew remove mysql
    
#!/bin/bash
PHANTOM_JS="phantomjs-1.9.8-linux-x86_64"
if [[ $EUID -ne 0 ]]; then
echo "You must be a root user" 2>&1
exit 1
else
apt-get update
apt-get install -y build-essential chrpath libssl-dev libxft-dev
apt-get install -y libfreetype6 libfreetype6-dev
apt-get install -y libfontconfig1 libfontconfig1-dev