Skip to content

Instantly share code, notes, and snippets.

View jahan-paisley's full-sized avatar
🌠
Working on lovely stuff

Jahan Zinedine jahan-paisley

🌠
Working on lovely stuff
View GitHub Profile
@jahan-paisley
jahan-paisley / Irancell.js
Created November 15, 2011 09:15
Irancell.js
function Message(serialnumber)
{
var This = this;
this.SerialNumber = serialnumber;
This.Found= false;
this.loadResult = function (data)
{
var jsonString = data;
var jsObj = eval("(" + jsonString + ')');
require 'net/http'
require 'uri'
require 'nokogiri'
require 'open-uri'
$address = 'http://www.asia.si.edu/archives/finding_aids/sevruguin.html'
$path = "~/Downloads/"
url = URI.parse($address)
puts "downloading"
@jahan-paisley
jahan-paisley / census_geographic_units_of_iran.rb
Created October 24, 2012 14:11
Extract census geographic units of Iran from Interior Ministry Website
# -*- coding: utf-8 -*-
require 'nokogiri'
require 'open-uri'
require 'debugger'
require 'net/http'
# Get a Nokogiri::HTML::Document for the page we’re interested in...
@jahan-paisley
jahan-paisley / new_customer.html
Created November 1, 2012 07:07
new customer full html
<!DOCTYPE html>
<!--[if lt IE 7]>
<html class="no-js lt-ie9 lt-ie8 lt-ie7">
<![endif]-->
<!--[if IE 7]>
<html class="no-js lt-ie9 lt-ie8">
<![endif]-->
<!--[if IE 8]>
<html class="no-js lt-ie9">
<![endif]-->
require 'em-http-request'
DEL = '-'*40
@results = 0
def run_with_proxy
connection_opts = {:proxy => {:host => '127.0.0.1', :port => 9050, :type => :socks5}}
conn = EM::HttpRequest.new("http://www.apolista.de/tegernsee/kloster-apotheke", connection_opts)
http = conn.get
http.callback {
require 'jcouchbase'
require 'json'
include Java
import com.couchbase.client.protocol.views.Query
class Couchbase
attr_accessor :client
@jahan-paisley
jahan-paisley / liferay-jboss.log
Created April 13, 2014 12:57
liferay-jboss.log
=========================================================================
JBoss Bootstrap Environment
JBOSS_HOME: /home/zeinoddin/Apps/liferay-portal-6.2-ce-ga2/jboss-7.1.1
JAVA: /usr/local/java/jdk1.6.0_45/bin/java
JAVA_OPTS: -server -XX:+UseCompressedOops -XX:+TieredCompilation -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true -Djboss.server.default.config=standalone.xml -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n -Dfile.encoding=UTF-8 -Djava.net.preferIPv4Stack=true -Duser.timezone=GMT -Xmx1024m -XX:MaxPermSize=512m
@jahan-paisley
jahan-paisley / RequestForChange.xpdl
Last active August 29, 2015 14:00
Shark XPDL Upload log
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://www.wfmc.org/2008/XPDL2.1" xmlns:xpdl="http://www.wfmc.org/2008/XPDL2.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Id="Package_requestforchange" xsi:schemaLocation="classpath:bpmnxpdl_31.xsd" >
<PackageHeader>
<XPDLVersion>2.1</XPDLVersion>
<Vendor/>
<Created/>
</PackageHeader>
<Script Type="text/java"/>
<TypeDeclarations>
<TypeDeclaration Id="Reference">
// Modulo 97 for huge numbers given as digit strings.
function mod97(digit_string)
{
var m = 0;
for (var i = 0; i < digit_string.length; ++i)
m = (m * 10 + parseInt(digit_string.charAt(i))) % 97;
return m;
}
// Calculate 2-digit checksum of an IBAN.
@jahan-paisley
jahan-paisley / p1.rb
Last active September 21, 2015 20:39
#! /usr/bin/ruby
def test(e,f)
(0..e.length-2).all?{|i| (e[i]-e[i+1]).abs==f[i]}
end
k= ARGV[0].to_i
a= (1..2*k-1).to_a
a.permutation(k).each do |e|
(a-e).permutation(k-1).each do |f|
puts e.to_s, f.to_s if test(e,f.to_a)