Skip to content

Instantly share code, notes, and snippets.

upstream lb-subprint {
ip_hash;
server 192.241.180.249:3222 weight=10 max_fails=3 fail_timeout=30s; # Reverse proxy to machine-1
server 192.241.241.152:3222 weight=10 max_fails=3 fail_timeout=30s; # Reverse proxy to machine-2
}
server {
listen 80;
server_name www.subprint.com subprint.com;
@satnami
satnami / x
Created March 10, 2016 04:40
AES encrypt and decrypt
CmdUtils.CreateCommand({
name: "AES encrypt",
takes: {plaintext: noun_arb_text},
modifiers: {key: noun_arb_text},
icon: "chrome://ubiquity/skin/icons/sum.png",
description: "Encrypt the selected text",
execute: function( directObj, modifiers)
{
if (modifiers.key.text.length <= 0)
displayMessage("No key has been enter selected.");
@satnami
satnami / astar.h
Created April 20, 2016 04:34 — forked from codemonkey-uk/astar.h
The C++ header file "astar.h" implements the A* graph search (route finding) algorithm using a C++ function template. The interface is written in an STL like style.
// -------------------------------------------------------------------------
// Filename: astar.h
// Version: 1.24
// Date: 2002/03/08
// Purpose: Provide template for a* algorythm
// (c) T.Frogley 1999-2002
// -------------------------------------------------------------------------
#ifndef ASTAR_H
#define ASTAR_H
@satnami
satnami / pg-pong.py
Created June 1, 2016 06:43 — forked from karpathy/pg-pong.py
Training a Neural Network ATARI Pong agent with Policy Gradients from raw pixels
""" Trains an agent with (stochastic) Policy Gradients on Pong. Uses OpenAI Gym. """
import numpy as np
import cPickle as pickle
import gym
# hyperparameters
H = 200 # number of hidden layer neurons
batch_size = 10 # every how many episodes to do a param update?
learning_rate = 1e-4
gamma = 0.99 # discount factor for reward
@satnami
satnami / introrx.md
Created October 27, 2016 14:20 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@satnami
satnami / linux_fun.md
Created May 29, 2017 08:09 — forked from marianposaceanu/linux_fun.md
How to have some fun using the terminal.

Linux fun-o-matic

How to have some fun using the terminal.

  1. Install cowsay [0] via : sudo apt-get install cowsay
  2. Install fortune [1] via : sudo apt-get install fortune
  3. Make sure you have Ruby installed via : ruby -v
  4. Install the lolcat [2] via : gem gem install lolcat
  5. Profit!
@satnami
satnami / scheduled_job.rb
Created March 17, 2019 07:11 — forked from ginjo/scheduled_job.rb
Recurring Job using Delayed::Job
# # # # # scheduled_job.rb - recurring schedules for delayed_job.rb # # # # #
#
# This file is version controlled at https://gist.github.com/ginjo/3688965
#
# Forked from https://gist.github.com/kares/1024726
#
# This is an enhanced version of the original scheduled_job.rb
# It was born out of the need to schedule a whole bunch of simple jobs.
# I started with the sample below and quickly found that I was repeating
# a lot of code. So I created the Delayed::Task pseudo-class that allows
@satnami
satnami / scheduled_job.rb
Created March 17, 2019 07:11 — forked from kares/scheduled_job.rb
Recurring Job using Delayed::Job
#
# Recurring Job using Delayed::Job
#
# Setup Your job the "plain-old" DJ (perform) way, include this module
# and Your handler will re-schedule itself every time it succeeds.
#
# Sample :
#
# class MyJob
# include Delayed::ScheduledJob
@satnami
satnami / gist:fb4ebb14bdd3c300b11517ac0d7a30df
Created March 17, 2019 07:13 — forked from JoshMcKin/gist:1648242
Recurring Delayed Job 2.1 in Rails 3 without patching
# Tested on DelayedJob 2.1
class MyRecurringDelayedJob
def perform
# ...some slow code
end
def success(job)
MyRecurringDelayedJob.schedule_job(job)
end
@satnami
satnami / commit_format.txt
Created April 6, 2019 16:47 — forked from mutewinter/commit_format.txt
My commit message format.
feat: add hat wobble
^--^ ^------------^
| |
| +-> Summary in present tense.
|
+-------> Type: chore, docs, feat, fix, refactor, style, or test.