Skip to content

Instantly share code, notes, and snippets.

View rihenperry's full-sized avatar
🚀
CSUCI graduate 2019 | problem solving

Rihan Pereira rihenperry

🚀
CSUCI graduate 2019 | problem solving
  • Spirent Communications
  • California, U.S.A
View GitHub Profile
@rihenperry
rihenperry / oauth_http_signatures.txt
Created November 24, 2018 10:12
using OAuth + digital signatures
POST some/url/
host : hmac.demo.org
Authorization: Signature keyID="my-key-name"
algorithm: "hmac-sha256"
headers: "content-length host date (request-target)",
signature: "j05o2...."
Date: Nov 28th, 2018
Accept: */*
Content-type: application/json
Content-length: 46
@rihenperry
rihenperry / oauth_v2.0_pwd_grant.txt
Created November 24, 2018 08:37
Oauth 2.0 - password grant
POST /oauth2.0/token
Host: api.server.io
User-agent: postman/v1.0.0
Accept: */*
Content-type: application/x-www-url-encoded
Content-length: 54
username=rihan&password=password&granttype=password
@rihenperry
rihenperry / result.json
Created March 23, 2016 07:02
mongoose/mongoDB/nodeJS populate query result
{
"_id": "56f13b504666f77e4652bbf3",
"user_id": "la6m5a1ha",
"uname": "lol",
"__v": 0,
"notify_options_fk_key": {
"_id": "56f13ba94666f77e4652bbf4",
"__v": 1,
"bid_opt_container": [
{
@rihenperry
rihenperry / query.js
Last active March 23, 2016 07:02
mongoose/mongoDB/NodeJS multiple doc populate query
var notifyconfigs = [
{path: 'notify_options_fk_key.buy_opt_container', model: 'BuyKeywordsOption'},
{path: 'notify_options_fk_key.ask_opt_container', model: 'AskKeywordsOption'},
{path: 'notify_options_fk_key.bid_opt_container', model: 'BidKeywordsOption'}
];
if(req.params && req.params.id) {
Usr
.findById(req.params.id)
.populate('notify_options_fk_key')
@rihenperry
rihenperry / topCoderAlgos_Fibonacii.java
Created November 22, 2014 17:51
topcoders problems
package topCoderAlgos;
/**
* This program generates topCoderAlgos.Fibonacii series till
* the target number
*/
import java.util.ArrayList;
public class Fibonacii {
private ArrayList<Integer> fibSeries;
import java.io.*;
import java.net.*;
import java.util.*;
public class MusicServer {
ArrayList<ObjectOutputStream> clientOutputStreams;
public static void main (String[] args) {
new MusicServer().go();
@rihenperry
rihenperry / BeatBoxFinal.java
Created March 7, 2013 15:51
This java program is a GUI client which loops drumming patterns.The central grid has 16 x 16 checkboxes which you mark/unmark for designing a drum pattern.i am plannig to extend this program by making the patterns serializable,so loading the saved patterns becomes feasible feature.Currently the work is under contruction.i will sooner make a revi…
import java.awt.*;
import javax.swing.*;
import java.io.*;
import javax.sound.midi.*;
import java.util.*;
import java.awt.event.*;
import java.net.*;
import javax.swing.event.*;
<?php
class Pages extends CI_Controller {
public function view($page = 'home')
{
if ( ! file_exists('application/views/pages/'.$page.'.php')) {
// show the fatal 404 error.
// the below function is CodeIgnitor's native built-in function
show_404();
@rihenperry
rihenperry / Controller.php
Created January 9, 2013 11:49
this is controller code from php's MVC framework 'CodeIgnitor'.
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* CodeIgniter
*
* An open source application development framework for PHP 5.1.6 or newer
*
* @package CodeIgniter
* @author ExpressionEngine Dev Team
* @copyright Copyright (c) 2008 - 2011, EllisLab, Inc.
* @license http://codeigniter.com/user_guide/license.html
@rihenperry
rihenperry / Blog.js
Created August 25, 2012 16:02
simple Template for adding Blog attributes
function Blog(body,date,image)
{
this.body=body;
this.date=date;
this.image=image;
}