This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- show privilegies for users | |
SELECT | |
pg_user.usename AS user_name, | |
t1.nspname as schema, | |
t1.relname as table, | |
relacl.privilege_type as type, | |
relacl.is_grantable | |
FROM ( | |
SELECT | |
pg_namespace.nspname, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object Demo extends App { | |
import Show.ShowOps | |
"hello world".show() | |
} | |
object Show { | |
def apply[A](implicit sh: Show[A]): Show[A] = sh | |
implicit class ShowOps[A: Show](a: A) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ru.izebit; | |
import org.apache.bcel.Const; | |
import org.apache.bcel.generic.*; | |
import java.io.FileOutputStream; | |
/** | |
* @author <a href="izebit@gmail.com">Artem Konovalov</a> <br/> | |
* Date: 27/04/2018/. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ru.izebit; | |
import org.I0Itec.zkclient.ZkClient; | |
import org.apache.zookeeper.server.NIOServerCnxnFactory; | |
import org.apache.zookeeper.server.ServerCnxnFactory; | |
import org.apache.zookeeper.server.ZooKeeperServer; | |
import java.io.File; | |
import java.net.InetSocketAddress; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#this example uses processing.js library | |
var maxDir = new PVector(width,height); | |
var maxMag = maxDir.mag(); | |
var Mover = function() { | |
this.position = new PVector(width/2, height/2); | |
this.velocity = new PVector(0, 0); | |
this.acceleration = new PVector(0, 0); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Adapted from Dan Shiffman, natureofcode.com | |
// Attractor: An object type for a draggable attractive body in our world | |
var Attractor = function() { | |
this.position = new PVector(width/2, height/2); | |
this.mass = 20; | |
this.G = 1; | |
this.dragOffset = new PVector(0, 0); | |
this.dragging = false; | |
this.rollover = false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var G = 1; | |
var Mover = function(m, x, y) { | |
this.mass = m; | |
this.position = new PVector(x, y); | |
this.velocity = new PVector(0, 0); | |
this.acceleration = new PVector(0, 0); | |
}; | |
Mover.prototype.applyForce = function(force) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angleMode = "radians"; | |
var Boulder = function(m, x, y) { | |
this.position = new PVector(x, y); | |
this.mass = m; | |
this.width = this.mass * 10; | |
this.angle = 0; | |
this.aVelocity = 0; | |
this.aAcceleration = 0; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static class CustomStackImpl<T extends Comparable<? extends T>> { | |
private final Node<T> EMPTY = new Node<>(null, null, null, -1); | |
private int counter = 0; | |
private Node<T> head = EMPTY; | |
private final TreeMap<T, SortedSet<Node<T>>> orderedMap = new TreeMap<>(); | |
public T push(T x) { | |
int index = counter++; | |
head = head.add(x, index); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class IteratorWrapper implements Iterator<String> { | |
private Iterator<?> i1; | |
private Iterator<?> i2; | |
private String value; | |
IteratorWrapper(Iterator<?> iterator) { | |
this.i1 = iterator; | |
this.i2 = Collections.emptyIterator(); | |
} |
OlderNewer