Skip to content

Instantly share code, notes, and snippets.

View ashim888's full-sized avatar

Ashim Lamichhane ashim888

View GitHub Profile
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib2
gh_url = 'https://api.github.com'
req = urllib2.Request(gh_url)
password_manager = urllib2.HTTPPasswordMgrWithDefaultRealm()
@ashim888
ashim888 / gist:5693851
Created June 2, 2013 15:28
python Automation Phase I
#-------------------------------------------------------------------------------
# Name: module1
# Purpose:
#
# Author: Ashim
#
# Created: 14/05/2013
# Copyright: (c) Ashim 2013
# Licence: <your licence>
#-------------------------------------------------------------------------------
@ashim888
ashim888 / gist:7810532
Created December 5, 2013 18:20
Adding files in Github
Create a new repository on the command line
touch README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/ashim888/iphoneQuiz.git
git push -u origin master
--------------------------------
@ashim888
ashim888 / Bisection in C
Created March 9, 2014 09:55
BISECTION METHOD IN C
#include<stdio.h>
#include <math.h>
#define ESP 0.01
//#define F(x) (x)*(x)*(x) + (x)*(x) + (x) + 7
#define F(x) (x)*(x) - 3
//#define F(x) (x)*(x)*(x)-0.165*(x)*(x)+0.0003993
void main()
{
int i = 1;
float low,up,mid;
@ashim888
ashim888 / secant.c
Created March 9, 2014 12:08
Secant Method Program
#include<stdio.h>
#include<math.h>
#define e 0.001
#define F(x) (2*x)-3
float frac(float a)
{
float f1;
f1=a*a-3*a+2;
return f1;
}
@ashim888
ashim888 / Rrandom
Created June 15, 2014 11:48
Random File Name Loop
what<-function(id=1:333){
fileLocation<-paste(getwd(),"/",sep="")
for(i in id){
if(i<10){
fileName<-paste("00",id,".csv",sep="")
return(fileName)
}
else{
fileName<-paste("0",id,".csv",sep="")
return(fileName)
@ashim888
ashim888 / frequency.py
Created July 14, 2014 18:38
frequency of the word "INTRO TO DATA SCIENCE" TWITTER FREQUENCY COUNT example
from __future__ import division
fuckthis=[['This','fucker','bastard'],['fucker','ok','go','no'],['my','home','is','far'],['hey','you','fucker']]
#print len(fuckthis)
unique_list=[]
my_dict={}
def totalwords():
total_words=0
for x in range(0,len(fuckthis)):
for y in fuckthis[x]:
# coding=UTF-8
from __future__ import division
import re
# This is a naive text summarization algorithm
# Created by Shlomi Babluki
# April, 2013
class SummaryTool(object):
@ashim888
ashim888 / safety.py
Last active July 6, 2016 11:05
Child Safety Detection
#!/usr/bin/python
# -*- coding: utf-8 -*-
from pymongo import MongoClient
import pprint
from nltk.corpus import stopwords
from nltk.tokenize import RegexpTokenizer
from microsofttranslator import Translator
import langid
porn_list=["anal","hentai","anus","arse","butt","arsehole","ass","fcuk","fuck","naked","xvideos","porn", "sex", "porno", "free porn", "porn tube", "porn videos", "streaming porn","Free porn", "sex videos","pussy","Porn hub", "xxx" "porn", "sex" ]