Skip to content

Instantly share code, notes, and snippets.

View raghavendrajain's full-sized avatar
💭
Learning a better way to run concurrent experiments

Raghvendra Jain raghavendrajain

💭
Learning a better way to run concurrent experiments
  • National Institute of Informatics
  • Tokyo, Japan
View GitHub Profile
@raghavendrajain
raghavendrajain / gist:10088905
Created April 8, 2014 03:53
Bayesian Network Experiments in R
{
"metadata": {
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
#include <Controller.h>
#include <ControllerEvent.h>
#include <Logger.h>
#include <ViewImage.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#define DEG2RAD(DEG) ( (M_PI) * (DEG) / 180.0 )
<?xml version="1.0" encoding="utf8"?>
<world name="myworld2">
<gravity x="0.0" y="-980.7" z="0.0"/>
<instanciate class="Man-nii.xml">
<set-attr-value name="name" value="kinect_man"/>
<set-attr-value name="language" value="c++"/>
#include <string>
#include <math.h>
#include "Controller.h"
#include "Logger.h"
#include "ControllerEvent.h"
#define DEG2RAD(DEG) ( (M_PI) * (DEG) / 180.0 )
using namespace std;
<?xml version="1.0" encoding="utf8"?>
<world name="myworld2">
<!--Gravity-->
<gravity x="0.0" y="-980.7" z="0.0"/>
<!--Agent "Man-nii"-->
<instanciate class="Man-nii.xml">
<!--Agent name-->
@raghavendrajain
raghavendrajain / get_machine_learning_wages_on_odesk.py
Created October 10, 2017 02:01 — forked from johnjosephhorton/get_machine_learning_wages_on_odesk.py
Get the hourly wages of machine learning contractors on oDesk
# John Horton
# www.john-joseph-horton.com
# Description: Answer to Quora question about machine learning hourly rates
# "http://www.quora.com/Machine-Learning/What-do-contractors-in-machine-learning-charge-by-the-hour"
from BeautifulSoup import BeautifulSoup
import urllib2
def contractors(skill, offset):
@raghavendrajain
raghavendrajain / checknhk.py
Last active July 26, 2019 02:01
Check if webpage exists from a new site
import urllib
import urllib.request
l = []
base = 125000
for i in range(0,200):
a = "https://www3.nhk.or.jp/nhkworld/hi/news/" + str(base + i) + "/"
req = urllib.request.Request(a)
try:
urllib.request.urlopen(req)
// pull down jquery into the JavaScript console
var script = document.createElement('script');
script.src = "https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js";
document.getElementsByTagName('head')[0].appendChild(script);
// grab the URLs
var urls = $('.rg_di .rg_meta').map(function() { return JSON.parse($(this).text()).ou; });
// write the URls to file (one per line)
var textToSave = urls.toArray().join('\n');
var hiddenElement = document.createElement('a');
hiddenElement.href = 'data:attachment/text,' + encodeURI(textToSave);
@raghavendrajain
raghavendrajain / unlock.py
Created June 7, 2019 01:49
To unlock the locked file
# install pikepdf using `pip install pikepdf`
import pikepdf
pdf = pikepdf.open('unextractable.pdf')
pdf.save('extractable.pdf')
@raghavendrajain
raghavendrajain / extract_pages_pdf.py
Created June 7, 2019 01:50
Extract pages from pdf
#install camelot or something like that for using PyPDF2
from PyPDF2 import PdfFileWriter, PdfFileReader
inputpdf = PdfFileReader(open("1_extractable.pdf", "rb"))
for i in range(inputpdf.numPages):
output = PdfFileWriter()
output.addPage(inputpdf.getPage(i))
with open("document-page%s.pdf" % i, "wb") as outputStream: