Skip to content

Instantly share code, notes, and snippets.

View Buffer0x7cd's full-sized avatar

Manvendra Singh Buffer0x7cd

View GitHub Profile
1 Moli Kadu BETN1CE12056 2014-15 4.23 FAIL IN * ,CEL0512[T],CEL0514[T], 5,8
2 Muzzammil Alam BETN1CE13031 2014-15 2.12 FAIL IN * ,CEL0510[T],CEL0512[T],CEL0515[T],,CEL0510[P],CEL0511[P],CEL0512[P],CEL0513[P],CEL0515[P] 3,4,5,6
3 Aakash Gohar BETN1CE14001 2014-15 7.17 PASS , 1,2,3,4,5,6
4 Abhay Kumar BETN1CE14002 2014-15 8.37 PASS , 1,2,3,4,5,6
5 Abhimany Singh Parihar BETN1CE14003 2014-15 3.46 FAIL IN * ,CEL0510[T],CEL0515[T],,CEL0510[P],CEL0511[P],CEL0515[P] 1,2,3,4,5,6
6 Abhinay Maheshwari BETN1CE14004 2014-15 7.85 PASS , 1,2,3,4,5,6
7 Abhyuday Mishra BETN1CE14006 2014-15 8.1 PASS , 1,2,3,4,5,6
8 Akash Kanjwani BETN1CE14007 2014-15 6.04 PASS , 1,2,3,4,5,6
9 Albert E Ngullie BETN1CE14008 2014-15 6.92 PASS , 1,2,3,4,5,6
10 Alkesh Pratap Singh BETN1CE14009 2014-15 3.77 FAIL IN * ,CEL0510[T],CEL0512[T],CEL0514[T], 1,2,3,4,5,6
@Buffer0x7cd
Buffer0x7cd / snakeeat.py
Last active September 21, 2017 09:53
Solution for snakeeat problem codechef( Getting a TLE)
''' Problem link: https://www.codechef.com/problems/SNAKEEAT
Approach
1: Get the maximum index x for which a[x] < K
2: set the search space for L with lower bound of 0 and upper bound of x+1
3: find the maximum value of l for which eq. K*L - sum(X-L+1,X) <= X-L+1 holds true
'''
def getValue(a,num):
'''Return the largest value of i for which a[i] < k'''
low = 0
#!/bin/sh
### BEGIN INIT INFO
# Provides: disable-transparent-hugepages
# Required-Start: $local_fs
# Required-Stop:
# X-Start-Before: mongod mongodb-mms-automation-agent
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Disable Linux transparent huge pages
# Description: Disable Linux transparent huge pages, to improve
@Buffer0x7cd
Buffer0x7cd / setup_mongo.sh
Created February 19, 2018 09:10
Set up mongo db and add admin
51
52
53
#!/bin/bash
# Admin User
MONGODB_ADMIN_USER=${MONGODB_ADMIN_USER:-"admin"}
MONGODB_ADMIN_PASS=${MONGODB_ADMIN_PASS:-"4dmInP4ssw0rd"}
{
"name": "ambassador",
"app_id": "7043185f",
"type": "ionic-angular",
"integrations": {
"cordova": {}
}
}
#!/bin/bash
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
apt-get update
apt-get install -y docker-ce
usermod -aG docker ubuntu
''' Create a virtualenv with python3 or run with default os installation (adjust the sheband based on you enviornment)
Install script dependencies with pip (requests, beautifulsoup4, lxml
make the script executable with chmod +x crawler.py
run the script with ./crawler.py
'''
#!/usr/bin/env python3
from bs4 import BeautifulSoup
import requests
FROM node:9.3.0-onbuild
COPY ./ /usr/src/app
RUN npm install
EXPOSE 3000
ENTRYPOINT ["npm"]
CMD ["run", "start"]
pid_t Fork(void)
{
pid_t pid = fork();
if (pid < 0)
{
perror("Error, while calling fork\n");
exit(EXIT_FAILURE);
}
return pid;
}
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <errno.h>
pid_t Fork(void)
{