Skip to content

Instantly share code, notes, and snippets.

View OrenBochman's full-sized avatar
🏠
Working from home

Oren Bochman OrenBochman

🏠
Working from home
  • WMF
  • 11:04 (UTC +03:00)
View GitHub Profile
@OrenBochman
OrenBochman / index.Rmd
Last active August 29, 2015 14:11 — forked from ramnathv/index.Rmd
two colum markdown format for use exclusively with revealjs
---
title : RevealJS with Bootstrap
framework : revealjs
widgets : [bootstrap] # {mathjax, quiz, bootstrap}
---
## Read-And-Delete
1. Edit YAML front matter
2. Write using R Markdown
@OrenBochman
OrenBochman / tomer.py
Last active August 29, 2015 14:12 — forked from daonb/tomer.py
'''
to make this work you need to have Open-Knesset source and latest db file
from the shell type::
$ python manage.py shell_plus
In [1]: ed tomer.py
'''
import json, urllib2
votes=[6904,7454,6786]
@OrenBochman
OrenBochman / analytics_facebook_dimension_widening.js
Last active August 29, 2015 14:18
google and facebook dimension widening
//facebook tag API allows sending custom data while tracking conversions and custom audiences
window._fbq = window._fbq || []; //required async call for reporting
// Custom Audience - event based tracking for customers who viewed a product in the 'Shoes' category with a price > $100
window._fbq.push(['track', 'ViewProduct', { //custom audience
product_id: 1234, //custom data
category: 'Shoes', //custom data
price: 110 //custom data
}]);
@OrenBochman
OrenBochman / designer.html
Last active August 29, 2015 14:22
designer
<link rel="import" href="../cool-clock/cool-clock.html">
<link rel="import" href="../google-map/google-map.html">
<link rel="import" href="../core-menu-button/core-menu-button.html">
<link rel="import" href="../core-icons/core-icons.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-field/core-field.html">
<link rel="import" href="../core-icon/core-icon.html">
<link rel="import" href="../core-input/core-input.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
@OrenBochman
OrenBochman / 00-CatScan readme.txt
Last active December 19, 2015 12:39
get the articles images etc... by category (from CatagoryIntersect.php tool by User:Duesentrieb)
CatScan modes:
cs -- pages by category
ts -- pages by template
al -- all pages
ss -- stubs := (having_less_than_x_bytes_1 || less_than_x_links_1 ) in mainspace
rc -- recent changes
iul -- all images
cl -- all categories
CREATE TABLE subjects(
id INT(11) NOT NULL AUTO_INCREMENT,
menu_name VARCHAR(30) NOT NULL,
position INT(3) NOT NULL,
visible TINTINT(1) NOT NULL,
PRIMERY KEY(id)
);
CREATE TABLE pages(
id INT(11) NOT NULL AUTO_INCREMENT,
@OrenBochman
OrenBochman / 00.sql
Last active December 19, 2015 17:18
SQL workload calculations
SELECT log_page, log_type, log_action, log_timestamp, log_user,user_id,user_name,log_timestamp,rev_timestamp,rev_page
FROM logging
JOIN user ON log_user = user_id
JOIN revision_userindex ON rev_page = log_page
WHERE log_type = "patrol"
AND log_action = "patrol"
AND user_name NOT LIKE '%bot' -- to filter robots
GROUP BY log_page
ORDER BY log_timestamp DESC -- to get the last actions
LIMIT 50; -- to reduce load
@OrenBochman
OrenBochman / 10 my top edits.sql
Created July 22, 2013 09:07
Finding closely affiliated friends. These queiries are built to operate on a small datasets at http://sqlfiddle.com/#!2/907b6/1. For work on a real wiki numbers in these queries will require fine tuning.
SELECT rev_page
FROM revision_userindex
INNER JOIN page ON page.page_id = rev_page
WHERE rev_user_text = "Jimbo Wales"
AND page_namespace IN (0,1)
GROUP BY rev_page
HAVING count(rev_page) > 20
ORDER BY COUNT(*) DESC
@OrenBochman
OrenBochman / calc difs of new usersdiff calculation
Created July 27, 2013 16:55
Analysis of social communication and information by user
SELECT CAST(parentrevision.rev_len AS SIGNED) - CAST(revision.rev_len AS SIGNED) AS diff FROM revision JOIN revision AS parentrevision ON parentrevision.rev_id = revision.rev_parent_id WHERE revision.rev_parent_id <> 0 ORDER BY revision.rev_id DESC LIMIT 1;
My first examples with [***knitr***](http://yihui.name/knitr/)
-----------------------------------------
Let's include some simple R code:
```{r}
1+2
```
That worked.
Let's include a plot:
```{r fig.width=4, fig.height=4}