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
  • 23:48 (UTC +03:00)
View GitHub Profile

[SQL Fiddle][1]

MySQL 5.6 Schema Setup:

-- schema
CREATE TABLE Client (
    ClientId INT         NOT NULL AUTO_INCREMENT,
    ClientName VARCHAR(35)     NOT NULL,
    Email varchar(100)   NOT NULL,

PhoneNumber VARCHAR(11),

@OrenBochman
OrenBochman / remove-docker-containers.md
Created August 6, 2017 10:19 — forked from ngpestelos/remove-docker-containers.md
How to remove unused Docker containers and images
  1. Delete all containers

     $ docker ps -q -a | xargs docker rm
    

-q prints only the container IDs -a prints all containers

Notice that it uses xargs to issue a remove container command for each container ID

  1. Delete all untagged images
@OrenBochman
OrenBochman / 01 Discrete Multinomial Bayesian Networks.Rmd
Last active August 23, 2017 06:39
Annotated Examples in R by M. Scutari and J.-B. Denis (2014)
---
title: '# Chapter 1: Discrete Case: Multinomial Bayesian Networks'
output:
html_document: default
html_notebook:
number_sections: yes
toc: yes
---
This R note book is my an annotated version of the code supplied with the first chapter of
@OrenBochman
OrenBochman / quicksim.R
Last active November 17, 2017 08:45
crash course in simulation in R
---
title: "R Notebook"
output:
html_notebook:
fig_caption: yes
toc: yes
---
```{r setup}
CREATE TABLE DIMENSIONS
([Campaign] varchar(1), [Device] varchar(1), [Date] date)
;
INSERT INTO DIMENSIONS
([Campaign], [Device], [Date])
VALUES
('A', 'M', '2017-10-07'),
('A', 'D', '2017-10-07'),
('A', 'T', '2017-10-07'),
@OrenBochman
OrenBochman / new_ubuntu.sh
Created January 17, 2018 21:16 — forked from borfast/new_linux.sh
A script to automatically install as much software as possible for my Ubuntu/Linux Mint development workstation
#!/bin/bash
## Assuming Linux Mint 18. Should also mostly work with Ubuntu 16.04
## Installing .deb packages could be done in a single go if I added the
## necessary repositories beforehand but this way the script is more
## modular and I can comment out any sections if I want to.
## TODO: install Prey
## TODO: Rewrite this with Salt/Ansible?
@OrenBochman
OrenBochman / index.html
Created January 17, 2018 22:27
Minimal example of using Lovefield [lovefield demo] // source https://jsbin.com/borane
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="description" content="[lovefield demo]">
<meta name="viewport" content="width=device-width">
<script src="https://unpkg.com/@reactivex/[email protected]/dist/global/Rx.js"></script>
<script src="https://unpkg.com/lovefield"></script>
<script src="https://unpkg.com/blockly"></script>
@OrenBochman
OrenBochman / text2png.py
Created February 7, 2018 22:26 — forked from destan/text2png.py
Python text to image (png) conversion with automatic new line calculation
# coding=utf8
import PIL
from PIL import ImageFont
from PIL import Image
from PIL import ImageDraw
def text2png(text, fullpath, color = "#000", bgcolor = "#FFF", fontfullpath = None, fontsize = 13, leftpadding = 3, rightpadding = 3, width = 200):
REPLACEMENT_CHARACTER = u'\uFFFD'
NEWLINE_REPLACEMENT_STRING = ' ' + REPLACEMENT_CHARACTER + ' '
import java.util.concurrent.Semaphore;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.RepeatedTest;
import org.junit.jupiter.api.Test;
@DisplayName("Little book of semaphores - Rendevous")
class Rendevous extends Thread {
@OrenBochman
OrenBochman / 01 Pages.sql
Last active October 5, 2022 07:05
Recreating the google analytics pages report
SELECT
hits.page.pagePath
FROM
'bigquery-public-data.google_analytics_sample.ga_sessions_20160801' AS GA,
UNNEST(GA.hits) AS hits
GROUP BY
hits.page.pagePath