Skip to content

Instantly share code, notes, and snippets.

View arya-oss's full-sized avatar
💭
I may be slow to respond.

Rajmani Arya arya-oss

💭
I may be slow to respond.
View GitHub Profile

for python interactive shell on windows in Git 2.3 onwards

python

instead write

winpty python

for simple http server

@arya-oss
arya-oss / redirect.c
Created January 16, 2016 09:39
input and output redirection in unix system in c language. very helpful in Networks Programming
/**
* Author: Rajmani Arya
* Originally By: http://stackoverflow.com/users/121747/jack
*/
static int fd_in, fd_out;
static fpos_t pos_in, pos_out;
void switchStdin(const char *newStream)
{
fflush(stdin);

Apt-Get settings on ubuntu 15.10

I've seen many people got stuck at

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install <any-package>

these command despite of setting http_proxy or HTTP_PROXY. Since Ubuntu 15.10, it removed apt-get default proxy configuration. So to overcome this, create an proxy configuration file

Vim settings for ubuntu

  cd
  vi .vimrc

add these lines to opened file

set nocompatible
set expandtab
set shiftwidth=4
@arya-oss
arya-oss / g++.sublime-build
Created April 11, 2016 16:43
C++ build option for sublime. create new build system and add following lines
{
"cmd": ["g++", "$file", "-o", "${file_path}/${file_base_name}"],
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.c",
"variants":
[
{
"name": "Run",
"shell": true,
@arya-oss
arya-oss / cns_modular_arithmetic.cpp
Created August 15, 2016 13:57
Calculate modulus of sum of to large integers with prime number
#include <iostream>
#include <string>
using namespace std;
int main () {
string num1, num2, res, len1;
cout << "Enter Number: "; cin >> num1;
cout << "Enter Number: "; cin >> num2;
int prime;
@arya-oss
arya-oss / substitution_cipher.md
Last active September 7, 2016 04:08
CNS Lab 4th day

Caesar Cipher

#include <bits/stdc++.h>
using namespace std;

#define SHIFT 3

int main(int argc, char * argv[]) {
    string str, crypt;
    cout << "Enter string: ";
@arya-oss
arya-oss / FastaInputFormat.java
Created November 14, 2016 06:22 — forked from jflatow/FastaInputFormat.java
Hadoop FASTA reader
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
@arya-oss
arya-oss / design_pattern_filesystem.ruby
Created November 16, 2016 19:59
FileSystem Design Patterns in Ruby
=begin
Purpose. File system with 8 GoF patterns
Composite --------------- directories that contain files, each of which could be a directory
Proxy ------------------- Unix logical link
Chain of Responsibility - pointer back to the parent directory to create
"fully qualified path name"
Iterator ---------------- use iterator to control the traversal of a Composite
$rating = 4;
$courseNumber = 1;
/* Author: Aneesh Makala
* Course Number starts from 0 to no. of courses
* Click on course feedback and then select a subject
* Open Dev Tools and goto COnsole Tab and Paste this script
*/
$scope = angular.element('[ng-controller=feedbackCourses]').scope();
for($i = 0; $i< $scope.course[$courseNumber].question.course.length; $i++){