Skip to content

Instantly share code, notes, and snippets.

View carlsverre's full-sized avatar
🪐
Building SQLSync

Carl Sverre carlsverre

🪐
Building SQLSync
View GitHub Profile
@carlsverre
carlsverre / schema.sql
Created April 30, 2020 22:14
MemSQL Telco Customer Churn Dataset
DROP DATABASE IF EXISTS churn_example;
CREATE DATABASE churn_example;
USE churn_example;
CREATE TABLE telco_customer_churn
(
customerID TEXT,
gender TEXT,
SeniorCitizen BOOLEAN,
Partner TEXT,
@carlsverre
carlsverre / samples.sql
Created March 14, 2020 16:15
Interesting approximations of PI (and other ideas) - by MemSQL Engineering
create database if not exists pi;
use pi
create table if not exists mc (d int, key() using clustered columnstore);
create table if not exists tries(iter integer, pi float);
delimiter //
CREATE OR REPLACE PROCEDURE px(iter INTEGER) AS
DECLARE
q query(value FLOAT) =
select 4*sum(d)/count(d) from mc;

To add a raspberry pi running raspbian jessie to the network add the following lines to the end of /etc/dhcpcd.conf and reboot:

interface eth0
static ip_address=10.110.0.1/24
static routers=10.110.0.1

To add a linux machine to the network run the associate setup_network script:

~ $ curl -I https://cache.nixos.org/nar/04llx3f88habsh8h8x73k31p3ym0v608bn8j67c7mv15ws263k74.nar.xz
HTTP/1.1 500 Internal Server Error
Content-Type: application/xml
Connection: keep-alive
Date: Fri, 23 Sep 2016 17:39:01 GMT
Server: AmazonS3
Age: 121
X-Cache: Error from cloudfront
Via: 1.1 ae162f6796e551002447afd7c07ec67a.cloudfront.net (CloudFront)
X-Amz-Cf-Id: tZeL92fiegpLt3j6VncFsYdLupW0ZmhCCd7Xf2I-U7F2xN5iYvJwXQ==
@carlsverre
carlsverre / keybase.md
Created July 18, 2016 20:07
keybase.md

Keybase proof

I hereby claim:

  • I am carlsverre on github.
  • I am carlsverre (https://keybase.io/carlsverre) on keybase.
  • I have a public key whose fingerprint is A940 F6CA 929F 7E26 5E89 C2E1 E5B3 FAD5 BEF7 CFC6

To claim this, I am signing this object:

@carlsverre
carlsverre / .cvimrc
Last active July 11, 2016 16:54
cVim config
set nosmoothscroll
set noautofocus
set typelinkhints
let searchlimit = 30
let scrollduration = 10
let scrollstep = 70
let searchalias g = "google"
let barposition = "bottom"
JavaRDD<String> inputFile = sparkContext.textFile(filePath, minPartitions).toJavaRDD();
JavaRDD<byte[]> bytes = inputFile.map(new Function<String, byte[]>(){
@Override
public byte[] call(String str) {
return ByteUtils.utf8StringToBytes(str);
}
});
return Option$.MODULE$.apply(JavaRDD.toRDD(bytes));
@carlsverre
carlsverre / 1_bug.tf
Last active November 12, 2015 00:27
Terraform bug with ignore_changes
provider "aws" {
region = "us-east-1"
}
resource "aws_vpc" "default" {
cidr_block = "172.17.0.0/24"
}
resource "aws_subnet" "default" {
vpc_id = "${aws_vpc.default.id}"
@carlsverre
carlsverre / breakpoints.scss
Created January 13, 2015 19:57
Simple SCSS breakpoint implementation
$breakpoints: (
zero: 0px,
small: 900px,
medium: 1200px,
medium-large: 1400px,
large: 1600px,
xlarge: 2000px
);
@mixin breakpoint($left, $right: null) {
@carlsverre
carlsverre / benchmark.py
Created March 6, 2013 19:08
Minimal python benchmark class
import time
import logging
from logging import StreamHandler, Formatter
minimal_logger = logging.getLogger(__name__ + "minimal")
minimal_logger.setLevel(logging.INFO)
_handler = StreamHandler()
_handler.setFormatter(Formatter('%(message)s'))
minimal_logger.addHandler(_handler)