Skip to content

Instantly share code, notes, and snippets.

View swist's full-sized avatar
💭
Cheese is best

Tomasz Nguyen swist

💭
Cheese is best
View GitHub Profile
@swist
swist / docker-compose.yml
Created March 23, 2021 15:10
KSQLDB with docker compose and JMX
---
version: '2'
services:
zookeeper:
image: confluentinc/cp-zookeeper:6.1.0
hostname: zookeeper
container_name: zookeeper
ports:
- '2181:2181'
[tool.black]
line-length = 95
target-version = ['py37']
skip-string-normalization = true
include = '\.pyi?$'
exclude = '''
/(
\.git
| \.hg
| \.mypy_cache
@swist
swist / keybase.md
Last active February 17, 2017 15:04
keybase.md

Keybase proof

I hereby claim:

  • I am swist on github.
  • I am swistak (https://keybase.io/swistak) on keybase.
  • I have a public key whose fingerprint is F23A 3D8A 10A1 D884 B5E1 8EB8 3A6E 3D2A E240 6659

To claim this, I am signing this object:

@swist
swist / ubuntu.yml
Created July 25, 2015 15:50
user fd
- name: set open fd soft and hard limit
lineinfile: dest=/etc/security/limits.conf regexp="{{ item.regexp }}" line="{{ item.line }}" insertbefore="# End of file" state=present
with_items:
- { regexp: '^neo4j\s+soft', line: 'neo4j soft nofile {{ neo4j_nofile_value }}' }
- { regexp: '^neo4j\s+hard', line: 'neo4j hard nofile {{ neo4j_nofile_value }}' }
when: neo4j_update_limits
- name: enable fd soft and hard limit
lineinfile: dest=/etc/pam.d/su regexp='^session\s+require\s+pam_limits' line='session required pam_limits.so' state=present
@swist
swist / q1.r
Created March 2, 2015 23:13
??!
library("testit")
library("MASS")
library("mvtnorm")
em.ll <- function(x, means, covariances, mix.props) {
probabilities <- mapply(dmvnorm, means, covariances, MoreArgs=list(x=x), SIMPLIFY=F)
mixed_probs <- Map("*", probabilities, mix.props)
mixed_probs <- Reduce("+", mixed_probs)
Reduce("+", Map(log, mixed_probs))
}
@swist
swist / q2.r
Created February 6, 2015 17:14
s7.r
# question 3
linear_discriminant <- function(x, mean, covariance, prior){
posterior = dmvnorm(x, mean, covariance)
g_i <- log(prior) + log(posterior)
g_i
}
quadratic_discriminant <- function(x, mean, covariance, prior)
{
W_i <- (-1/2) * solve(covariance)
@swist
swist / Graph.js
Last active August 29, 2015 14:11
sails resource policy
/**
* Graph.js
*
* @description :: TODO: You might write a short summary of how this model works and what it represents here.
* @docs :: http://sailsjs.org/#!documentation/models
*/
module.exports = {
attributes: {
@swist
swist / .gitconfig
Created October 22, 2014 14:46
git config settings
[branch]
autosetupmerge = true
autosetuprebase = always
[push]
default = tracking
[rerere]
enabled =1
angular.module('Facebook', [])
.factory('Facebook', function($rootScope, $q){
var facebook = {};
/**
* @name facebook.getPermission
* @requires $q
*
* @description
* Try to receive permissions from Facebook.