text stringlengths 9 39.2M | dir stringlengths 26 295 | lang stringclasses 185
values | created_date timestamp[us] | updated_date timestamp[us] | repo_name stringlengths 1 97 | repo_full_name stringlengths 7 106 | star int64 1k 183k | len_tokens int64 1 13.8M |
|---|---|---|---|---|---|---|---|---|
```shell
#!/bin/sh
conf_file="${SNAP_DATA}/AdGuardHome.yaml"
readonly conf_file
if ! [ -f "$conf_file" ]
then
xdg-open 'path_to_url
exit
fi
# Get the admin interface port from the configuration.
awk_prog='/^[^[:space:]]/ { is_http = /^http:/ };/^[[:space:]]+address:/ { if (is_http) print $2 }'
readonly awk_prog... | /content/code_sandbox/snap/local/adguard-home-web.sh | shell | 2016-07-06T10:31:47 | 2024-08-16T18:17:06 | AdGuardHome | AdguardTeam/AdGuardHome | 24,082 | 163 |
```go
// Code generated by go run ./scripts/blocked-services/main.go; DO NOT EDIT.
package filtering
// blockedService represents a single blocked service.
type blockedService struct {
ID string `json:"id"`
Name string `json:"name"`
IconSVG []byte `json:"icon_svg"`
Rules []string `json:"rules"`
}
... | /content/code_sandbox/internal/filtering/servicelist.go | go | 2016-07-06T10:31:47 | 2024-08-16T18:17:06 | AdGuardHome | AdguardTeam/AdGuardHome | 24,082 | 122,024 |
```java
package data_structures;
import java.util.Arrays;
public class MoAlgorithm {
// Queries: Given L and R, find the number of distinct values in [L, R]
static int ans; // answer of the current range
static int[] count; // count[i] = frequency of value i in the current range
static void add(int val)
... | /content/code_sandbox/data_structures/MoAlgorithm.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 387 |
```java
package data_structures;
public class SQRT_Decomposition {
// Query Type: find sum of subarray [L, R]
static int[] preprocess(int[] a, int n)
{
int s = (int) Math.sqrt(n) + 1;
int[] b = new int[(n + s - 1)/ s];
for(int i = 0; i < n; ++i)
b[i / s] += a[i];
return b;
}
static int query(int[]... | /content/code_sandbox/data_structures/SQRT_Decomposition.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 282 |
```java
package data_structures;
import java.util.Random;
// TODO Needs Testing
public class TreapSet <K extends Comparable<K>>
{
class Node<T extends Comparable<T>>
{
T key;
Node<T> left, right;
int prior, size;
Node(T k, int p, int s, Node<T> l, Node<T> r)
{
key = k;
prior = p;
size = s;
l... | /content/code_sandbox/data_structures/TreapSet.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 994 |
```java
package data_structures;
import java.util.Random;
//0- based indexable skip list.
public class IndexableSkipList <E extends Comparable<E>> {
class Node
{
E value;
int level;
int length;
Node next;
Node down;
public Node(E val, int lvl, int ps, Node nxt, Node dwn)
{
value = val;
leve... | /content/code_sandbox/data_structures/IndexableSkipList.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 1,235 |
```java
package data_structures;
import java.util.*;
public class SkipList <T extends Comparable<T>>
{
class Node
{
Node next, down;
int level;
T value;
public Node(T v, int l, Node n, Node d)
{
value = v;
level = l;
next = n;
down = d;
}
}
Node head;
R... | /content/code_sandbox/data_structures/SkipList.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 510 |
```java
package data_structures;
//Union-Find Disjoint Sets Library written in OOP manner, using both path compression and union by rank heuristics
public class UnionFind {
int[] p, rank, setSize;
int numSets;
public UnionFind(int N)
{
p = new int[numSets = N];
r... | /content/code_sandbox/data_structures/UnionFind.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 311 |
```java
package data_structures;
// static Range Minimum Query, DP Solution
public class SparseTable {
int A[], SpT[][];
SparseTable(int[] A)
{
int n = A.length; this.A = A;
int k = (int)Math.floor(Math.log(n) / Math.log(2)) + 1;
SpT = new int[n][k];
for (... | /content/code_sandbox/data_structures/SparseTable.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 413 |
```java
package data_structures.sortings;
public class MergeSort
{
/*
* - Complexity O(n log n)
* - Stable sort algorithm
* - Can be used to compute inversion index
*/
static final int INF = Integer.MAX_VALUE;
static void mergeSort(int[] a, int b, int e)
{
if(b < e)
{
int q = (b + e) / 2;
merge... | /content/code_sandbox/data_structures/sortings/MergeSort.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 320 |
```java
package data_structures.linear;
public class Bitmask {
static int setBit(int S, int j) { return S | 1 << j; }
static int clearBit(int S, int j) { return S & ~(1 << j); }
static int toggleBit(int S, int j) { return S ^ 1 << j; }
static boolean isOn(int S, int j) { return (S & 1 << j) != 0; }
static in... | /content/code_sandbox/data_structures/linear/Bitmask.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 274 |
```java
package data_structures.trees;
import java.util.Scanner;
// Range Sum Query (with lazy propagation)
public class SegmentTree { // 1-based DS, OOP
int N; //the number of elements in the array as a power of 2 (i.e. after padding)
int[] array, sTree, lazy;
SegmentTree(int[] in)
{
array = in; N =... | /content/code_sandbox/data_structures/trees/SegmentTree.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 856 |
```java
package data_structures;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
public class HLD {
//1.Take input and processing(precomputation + query)
static int N, nodeVal[]; //input
static ArrayList<Integer>[] adjList; //input
@SuppressWarnings("unchecked")
public static... | /content/code_sandbox/data_structures/HLD.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 1,812 |
```java
package data_structures.trees;
public class PersistentSegmentTree {
class Node
{
Node left, right; int sum;
Node(int x) { sum = x; }
Node(Node left, Node right)
{
this.left = left;
this.right = right;
if(left != null)
... | /content/code_sandbox/data_structures/trees/PersistentSegmentTree.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 384 |
```java
package data_structures.trees;
public class FenwickTree { // one-based DS
int n;
int[] ft;
FenwickTree(int size) { n = size; ft = new int[n+1]; }
int rsq(int b) //O(log n)
{
int sum = 0;
while(b > 0) { sum += ft[b]; b -= b & -b;} //min?
return sum;
}
int rsq(int a, int b) { return rsq(b) -... | /content/code_sandbox/data_structures/trees/FenwickTree.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 445 |
```java
package data_structures.trees;
public class SegmentTree2D { // subrectangle sum, point update
int[][] matrix;
int[][] tree;
int N, M;
SegmentTree2D(int[][] a)
{
matrix = a;
N = 1; while(N < a.length) N <<= 1;
M = 1; while(M < a[0].length) M <<= 1;
build... | /content/code_sandbox/data_structures/trees/SegmentTree2D.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 1,099 |
```java
package other_algorithms;
public class Shuffle {
static void shuffle(int[] a)
{
int n = a.length;
for(int i = 0; i < n; i++)
{
int r = i + (int)(Math.random() * (n - i));
int tmp = a[i];
a[i] = a[r];
a[r] = tmp;
}
}
}
``` | /content/code_sandbox/other_algorithms/Shuffle.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 89 |
```java
package other_algorithms;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Stack;
/*
* Longest Increasing Subsequence - O(n log n) solution
*
* Main Variables
* ==============
* - A is the original array containing elements for which we need to find LIS
* - L is built incremen... | /content/code_sandbox/other_algorithms/LIS.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 573 |
```java
package data_structures.trees;
import java.io.IOException;
import java.util.Arrays;
import java.util.Scanner;
public class QuadTree {
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int N = (int) Math.pow(2, Math.ceil(Math.lo... | /content/code_sandbox/data_structures/trees/QuadTree.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 1,532 |
```java
package other_algorithms;
/*
* Convex Hull Optimization
* dp[i] = min(j < i){ dp[j] + a[i] * b[j] } where b[j] >= b[j + 1]
*
* Original Complexity: O(n^2)
* Optimized Complexity: O(n log n) or O(n) if a[i] <= a[i + 1]
*
* Following operations are used within the DP function
*
* Can be trapped in ov... | /content/code_sandbox/other_algorithms/ConvexHullOptimization1.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 500 |
```java
package other_algorithms;
/*
* Convex Hull Optimization
* dp[i] = min(j < i){ dp[j] + a[i] * b[j] } where b[j] >= b[j + 1]
*
* Original Complexity: O(n^2)
* Optimized Complexity: O(n log n) or O(n) if a[i] <= a[i + 1]
*
* Following operations are used within the DP function
*
* Overflow avoided ass... | /content/code_sandbox/other_algorithms/ConvexHullOptimization2.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 325 |
```java
package other_algorithms;
public class Precomputation {
//1. Precompute the number of ones in a given number
static int[] bitCount;
static void pre(int n)
{
bitCount = new int[1<<n];
for(int i = 0; i < n; i++)
bitCount[1<<i] = 1;
for(int i = 1; i < 1<<n; i++)
{
bitCount[i] = 1 + bitCount[i ... | /content/code_sandbox/other_algorithms/Precomputation.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 229 |
```java
package other_algorithms;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
class Scanner
{
StringTokenizer st;
BufferedReader br;
public Scanner(InputStream s){ br = new BufferedReader(new InputStrea... | /content/code_sandbox/other_algorithms/Scanner.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 329 |
```java
package geometry;
import java.io.IOException;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;
import java.util.TreeSet;
public class LineSweep
{
static final double EPS = 1e-9;
public static void main(String[] args) throws NumberFormatException, IOException
{
Scanner sc... | /content/code_sandbox/geometry/LineSweep.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 466 |
```java
package geometry;
public class Line {
static final double INF = 1e9, EPS = 1e-9;
double a, b, c;
Line(Point p, Point q)
{
if(Math.abs(p.x - q.x) < EPS) { a = 1; b = 0; c = -p.x; }
else
{
a = (p.y - q.y) / (q.x - p.x);
b = 1.0;
c = -(a * p.x + p.y);
}
}
Line(Point p, double m... | /content/code_sandbox/geometry/Line.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 368 |
```java
package geometry;
public class LineSegment {
Point p, q;
LineSegment(Point a, Point b) { p = a; q = b; }
boolean intersect(LineSegment ls)
{
Line l1 = new Line(p, q), l2 = new Line(ls.p, ls.q);
if(l1.parallel(l2))
{
if(l1.same(l2))
return p.between(ls.p, ls.q) || q.between(ls.p, ls.q) ||... | /content/code_sandbox/geometry/LineSegment.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 158 |
```java
package geometry;
public class Geometry {
static final double INF = 1e9, EPS = 1e-9; // better use 1e-11 for large coordinates and 1e-15 if infinite precision is required
static double degToRad(double d) { return d * Math.PI / 180.0; }
static double radToDeg(double r) { return r * 180.0 / Math.PI; }
... | /content/code_sandbox/geometry/Geometry.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 357 |
```java
package geometry;
import java.util.Arrays;
public class Polygon {
// Cases to handle: collinear points, polygons with n < 3
static final double EPS = 1e-9;
Point[] g; //first point = last point, counter-clockwise representation
Polygon(Point[] o) { g = o; }
double perimeter()
{
double sum = ... | /content/code_sandbox/geometry/Polygon.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 1,212 |
```java
package geometry;
public class Triangle {
static final double EPS = 1e-9;
Point a, b, c;
double ab, bc, ca;
Triangle(Point p, Point q, Point r) //counter clockwise
{
a = p;
if(Point.ccw(p, q, r)) { b = q; c = r; }
else { b = r; c = q; }
ab = a.dist(b); bc = b.dist(c); ca = c.dist(a);
}
dou... | /content/code_sandbox/geometry/Triangle.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 862 |
```java
package geometry;
public class Circle { //equation: (x-c.x)^2 + (y-c.y)^2 = r^2
static final double EPS = 1e-9;
Point c;
double r;
Circle(Point p, double k) { c = p; r = k; }
int inside(Point p) //1 for inside, 0 for border, -1 for outside
{
double d = p.dist(c);
return d + EPS < r ? 1 : Math.... | /content/code_sandbox/geometry/Circle.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 777 |
```java
package geometry;
public class Point implements Comparable<Point>{
static final double EPS = 1e-9;
double x, y;
Point(double a, double b) { x = a; y = b; }
public int compareTo(Point p)
{
if(Math.abs(x - p.x) > EPS) return x > p.x ? 1 : -1;
if(Math.abs(y - p.y) > EPS) return y... | /content/code_sandbox/geometry/Point.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 1,009 |
```java
package geometry;
public class Vector {
double x, y;
Vector(double a, double b) { x = a; y = b; }
Vector(Point a, Point b) { this(b.x - a.x, b.y - a.y); }
Vector scale(double s) { return new Vector(x * s, y * s); } //s is a non-negative value
double dot(Vector v) { return (x * v.x + y *... | /content/code_sandbox/geometry/Vector.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 174 |
```java
package geometry;
public class Rectangle {
static final double EPS = 1e-9;
Point ll, ur;
Rectangle(Point a, Point b) { ll = a; ur = b; }
double area() { return (ur.x - ll.x) * (ur.y - ll.y); }
boolean contains(Point p)
{
return p.x <= ur.x + EPS && p.x + EPS >= ll.x && p.y <= ur.y + EPS && p.y + ... | /content/code_sandbox/geometry/Rectangle.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 226 |
```java
package math;
public class Polynomial {
static final double EPS = 1e-9;
int degree, coeffs[];
Polynomial(int[] c) { degree = c.length - 1; coeffs = c; }
double evaluate(double x) // O(degree)
{
double res = 0.0;
for(int i = degree; i >= 0; --i)
res = res * x + coeffs[i];
return res;
}
... | /content/code_sandbox/math/Polynomial.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 295 |
```java
package math;
import java.util.ArrayList;
import java.util.Collections;
public class Permutations {
/*
* 1. Compute Next Permutation
*/
static boolean nextPermutation(char[] c)
{
// 1. finds the largest k, that c[k] < c[k+1]
int first = getFirst(c);
if(first == -1)
return false;
// 2. fin... | /content/code_sandbox/math/Permutations.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 757 |
```java
package math;
public class Exponentiation {
/*
* 1. Binary Exponentiation
*/
static int pow(int a, int e) // O(log e)
{
int res = 1;
while(e > 0)
{
if((e & 1) == 1)
res *= a;
a *= a;
e >>= 1;
}
return res;
}
/*
* 2. Fast Exponentiation
*/
static int modPow(int a, int e,... | /content/code_sandbox/math/Exponentiation.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 650 |
```java
package math;
import java.math.BigInteger;
public class NewtonMethod {
/*
* Newton's Method: Xn+1 = Xn - f(Xn) / f'(Xn)
* Purpose: Find roots of a real-valued function, i.e. solve f(x) = 0
*/
static final double EPS = 1e-15;
/*
* 1. Find square root of n
*/
static double sqrt(double n)
{
... | /content/code_sandbox/math/NewtonMethod.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 391 |
```java
package math.game_theory;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.Queue;
/*
* Algorithm for finding winning, losing and draw positions in games
* that can represented by a directed graph (possibly with cycles)
*/
public class GamesOnGeneralGraphs {
static boolean[] win, ... | /content/code_sandbox/math/game_theory/GamesOnGeneralGraphs.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 295 |
```java
package math.game_theory;
import java.util.ArrayList;
/*
* Example on Games on General Graphs (path_to_url
*/
public class PoliceAndThief {
static final int[] dx = new int[] {0, 0, 0, -1, 1, -1, 1, -1, 1};
static final int[] dy = new int[] {0, -1, 1, 0, 0, -1, 1, 1, -1};
static final int POLICE = 0, TH... | /content/code_sandbox/math/game_theory/PoliceAndThief.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 756 |
```java
package math.number_theory;
public class ExtendedEuclid {
/*
* Extended Euclid Algorithm for Solving Linear Diophantine Equation
* Solve: ax + by = c. Let d = gcd(a, b).
* If d | c, then it has infinite number of solutions. Otherwise, it has no solution.
*
* The solution derived is one of the mini... | /content/code_sandbox/math/number_theory/ExtendedEuclid.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 281 |
```java
package math.number_theory;
import java.util.ArrayList;
public class PrimeFactorization {
static ArrayList<Integer> primes; // generated by sieve
/*
* 1. Generating a list of prime factors of N
*/
static ArrayList<Integer> primeFactors(int N) // O(sqrt(N) / ln sqrt(N))
{
ArrayList<Integer> f... | /content/code_sandbox/math/number_theory/PrimeFactorization.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 542 |
```java
package math.number_theory;
import java.util.ArrayList;
public class PrimeNumbers {
/*
* 1. Sieve of Eratosthenes: generate all primes in [2, N]
*/
static ArrayList<Integer> primes;
static int[] isComposite;
static void sieve(int N) // O(N log log N)
{
isComposite = new int[N+1];
isCompos... | /content/code_sandbox/math/number_theory/PrimeNumbers.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 543 |
```java
package math.combinatorics;
public class Fibonacci {
static int fib[];
static int fibonacci(int n) //O(log n)
{
if (n == 0)
return 0;
if (n <= 2)
return 1;
if (fib[n] != -1)
return fib[n];
int k = n >> 1;
int a = fibonacci(k), b = fibonacci(k+1);
if (n%2 == 0)
return fib[n... | /content/code_sandbox/math/combinatorics/Fibonacci.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 142 |
```java
package math.number_theory;
import java.util.Arrays;
public class ModifiedSieve {
/*
* 1. Modified sieve for number of prime factors
*/
static void numPF(int N)
{
int[] pf = new int[N];
for(int i = 2; i < N; ++i)
if(pf[i] == 0)
for(int j = i; j < N; j += i)
{
int p = 0, k = j;
... | /content/code_sandbox/math/number_theory/ModifiedSieve.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 421 |
```java
package math.combinatorics;
import java.util.ArrayList;
import java.util.Arrays;
public class InclusionExclusionPrinciple {
/*
* 1. Count the number of numbers in the range [1, r] that are coprime with n
*/
static int countCoprime(int n, int r) // O(sqrt(n))
{
ArrayList<Integer> primes = new Arra... | /content/code_sandbox/math/combinatorics/InclusionExclusionPrinciple.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 633 |
```java
package math.combinatorics;
public class BinomialCoefficient {
/*
* 1. Pascal's Rule: recursive | Top-down approach
*/
static long[][] comb; //may need BigInteger, if the numbers are large, use a treemap
static long nCr1(int n , int k)
{
if(n < k)
return 0;
if(k == 0 || k == n)
return 1;... | /content/code_sandbox/math/combinatorics/BinomialCoefficient.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 573 |
```java
package graphs.mst;
import java.util.ArrayList;
import java.util.PriorityQueue;
public class MST_Prim {
static ArrayList<Edge>[] adjList;
static int V;
static int prim() //O(E log E)
{
int mst = 0;
boolean[] visited = new boolean[V];
PriorityQueue<Edge> pq = new PriorityQueue<Edge>();
pq.add(n... | /content/code_sandbox/graphs/mst/MST_Prim.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 228 |
```java
package graphs.mst;
import java.util.Arrays;
public class MST_Kruskal {
static Edge[] edgeList;
static int V;
static int kruskal() //O(E log E)
{
int mst = 0;
Arrays.sort(edgeList);
UnionFind uf = new UnionFind(V);
for(Edge e: edgeList)
if(uf.union(e.u, e.v))
mst += e.w;
return mst;
... | /content/code_sandbox/graphs/mst/MST_Kruskal.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 359 |
```java
package graphs.traversal;
import java.util.ArrayList;
/*
* Articulation Points and Bridges in Undirected Graphs - Tarjan's Algorithm (DFS Variant)
*/
public class ArticulationPointsAndBridges {
static ArrayList<Integer>[] adjList;
static int[] dfs_low, dfs_num, parent;
static int V, counter, root, rootC... | /content/code_sandbox/graphs/traversal/ArticulationPointsAndBridges.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 343 |
```java
package graphs.traversal;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Stack;
public class GraphTraversal {
static final int VISITED = 2, EXPLORED = 1, UNVISITED = 0;
static ArrayList<Integer>[] adjList;
static boolean[] visited, adjMat[];
static int V... | /content/code_sandbox/graphs/traversal/GraphTraversal.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 1,205 |
```java
package graphs.traversal;
import java.util.ArrayList;
import java.util.Stack;
public class BridgeTree {
static ArrayList<Integer>[] adjList, tree;
static Stack<Integer> stack;
static int[] dfs_low, dfs_num, bridgeComp;
static int V, counter;
static void bridgeTree()
{
counter = 0;
dfs_low = new i... | /content/code_sandbox/graphs/traversal/BridgeTree.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 411 |
```java
package graphs.traversal;
import java.util.ArrayList;
import java.util.Stack;
/*
* Strongly Connected Components (Directed Graphs) - Tarjan's Algorithm (DFS Variant)
*/
public class StronglyConnectedComponents1 {
static ArrayList<Integer>[] adjList;
static int V, counter, SCC, dfs_num[], dfs_low[];
stat... | /content/code_sandbox/graphs/traversal/StronglyConnectedComponents1.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 294 |
```java
package graphs.traversal;
import java.util.ArrayList;
import java.util.Stack;
// Kosaraju's Algorithm: Finding Strongly Connected Components of a directed graph
public class KosarajuAlgorithm {
static int N;
static ArrayList<Integer>[] adjList, adjListR, graph;
static Stack<Integer> stack;
static boole... | /content/code_sandbox/graphs/traversal/KosarajuAlgorithm.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 277 |
```java
package graphs.traversal;
import java.util.ArrayList;
public class BridgesOnline {
/*
* WARNING: NOT TESTED BEFORE
*
* - A block is a set of connected nodes with no bridges.
* - A Component is a set of connected nodes possibly bridges.
* It consists of several blocks forming a tree (bridge tree)... | /content/code_sandbox/graphs/traversal/BridgesOnline.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 908 |
```java
package graphs.traversal;
import java.util.ArrayList;
import java.util.Scanner;
import java.util.Stack;
/*
* Biconnected Components
*/
public class BiconnectedComponents {
static ArrayList<Integer>[] adjList, inBiComp;
static int[] dfs_low, dfs_num;
static int V, counter, biCompIdx;
static Stack<Intege... | /content/code_sandbox/graphs/traversal/BiconnectedComponents.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 573 |
```java
package graphs.special;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.ListIterator;
/*
* Printing Euler Tour in an Eulerian Graph
*/
public class EulerTour {
static class Edge
{
int node;
boolean used;
Edge(int x) { node = x; }
}
static ArrayList<Edge>[] adjList;
sta... | /content/code_sandbox/graphs/special/EulerTour.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 419 |
```java
package graphs.shortest_path;
/*
* All-Pairs Shortest Path
*/
public class APSP {
static int[][] adjMatrix;
static int[][] p;
static int V;
static void floyd()
{
//adjMatrix contains: directed edges, zero for i=j, INF (1B) otherwise
p = new int[V][V]; //to find the parent on the shortest path... | /content/code_sandbox/graphs/shortest_path/APSP.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 318 |
```java
package graphs.special;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Queue;
// Maximum Cardinality Bipartite Matching
// 1.Augmenting Path Algorithm
// 2.Hopcroft Karp's Algorithm
// 3.Max Flow based Solution
public class MCBM {
// 1.Augmenting Path Al... | /content/code_sandbox/graphs/special/MCBM.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 813 |
```java
package graphs.shortest_path;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.PriorityQueue;
/*
* Single-Source Shortest Path
*/
public class SSSP {
static final int INF = (int)1e9; //don't increase, avoid overflow
static ArrayList<Edge>[] adjList;
static int V;
/*
* 1. Dijkst... | /content/code_sandbox/graphs/shortest_path/SSSP.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 591 |
```java
package graphs.trees;
import java.util.*;
class EulerWalk { // Euler walk on a rooted tree
static ArrayList<Integer>[] children;
static int[] E, L, tin, tout;
static int N, t;
static void dfs(int u, int depth)
{
tin[u] = t;
E[t] = u;
L[t++] = depth;
for(int v: children[u])
{
dfs(v, depth... | /content/code_sandbox/graphs/trees/EulerWalk.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 266 |
```java
package graphs.trees;
//Build the tree using the in-order and post-order traversals
public class TreeTraversal {
static class Node { int val; Node left, right; Node(int x) { val = x; } }
//idxOf is the idx of the specified node in the in[] array
static Node buildTree(int[] post, int[] in, int[] id... | /content/code_sandbox/graphs/trees/TreeTraversal.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 294 |
```java
package graphs.trees;
//1. Calculate the height of the tree rooted at node u for all nodes
//2. find the proper root of a given tree
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.Queue;
public class TreeDiameter {
static ArrayList<Integer>[] adjList;
static int N, dp_down[][],... | /content/code_sandbox/graphs/trees/TreeDiameter.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 625 |
```java
package graphs.trees;
import java.util.Arrays;
/*
* Lowest Common Ancestor in a Rooted Tree
*
* Algorithm 1: Parent Sparse Table
* Algorithm 2: Euler Walk + RMQ
*/
public class LCA {
/*
* Algorithm 1: Parent Sparse Table
*/
static int N, L[], P[][]; // P[i][j] --> the 2^j th ancestor of node i
... | /content/code_sandbox/graphs/trees/LCA.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 596 |
```java
package graphs.max_flow;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Queue;
//Try to test the implementation with some input of your choice
public class MaxFlow2 {
static final int INF = (int)1e9;
static int V, s, t, res[][]; //input
static ArrayList... | /content/code_sandbox/graphs/max_flow/MaxFlow2.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 444 |
```java
package graphs.max_flow;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Queue;
/*
* Max Flow: Edmonds Karp's Algorithm
*/
public class MaxFlow1 {
static final int INF = (int)1e9;
static int V, s, t; //s != t
static ArrayList<Integer>[] adjList;
stat... | /content/code_sandbox/graphs/max_flow/MaxFlow1.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 391 |
```java
package graphs.max_flow;
import java.util.LinkedList;
import java.util.Queue;
//Try to test the implementation with some input of your choice
public class MaxFlow3 {
static final int INF = (int)1e9;
static int V, s, t, c[][]; //input
static int pushRelabel() //O(V^3)
{
int[] h = new int[V], e = ne... | /content/code_sandbox/graphs/max_flow/MaxFlow3.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 573 |
```java
package strings;
public class SuffixArray {
int[] SA;
SuffixArray(char[] s) //has a terminating character (e.g. '$')
{
int n = s.length, RA[] = new int[n];
SA = new int[n];
for(int i = 0; i < n; ++i) { RA[i] = s[i]; SA[i] = i; }
for(int k = 1; k < n; k <<= 1)
{
sort(SA, RA, n, k);
... | /content/code_sandbox/strings/SuffixArray.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 480 |
```java
package strings;
import java.util.TreeMap;
public class SuffixAutomaton {
int[] link, len;
TreeMap<Character, Integer>[] next;
int lst, idx;
SuffixAutomaton(char[] s)
{
int n = s.length;
link = new int[n<<1];
len = new int[n<<1];
next = new TreeMap[n<<1];
next[0] = new TreeMap<>();
for(cha... | /content/code_sandbox/strings/SuffixAutomaton.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 304 |
```java
package strings;
public class Z_Algorithm {
static int[] zAlgo(char[] s)
{
int n = s.length;
int[] z = new int[n];
for(int i = 1, l = 0, r = 0; i < n; ++i)
{
if(i <= r)
z[i] = Math.min(r - i + 1, z[i - l]);
while(i + z[i] < n && s[z[i]] == s[i + z[i]])
++z[i];
if(i + z[i] - 1 > r)
... | /content/code_sandbox/strings/Z_Algorithm.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 155 |
```java
package strings;
public class PrefixAutomaton {
//Prefix Function: pi[k] = length of longest proper prefix matching a suffix ending at k
static int[] prefixFunction(char[] s) // O(n)
{
int n = s.length, pi[] = new int[n];
for(int i = 1, j = 0; i < n; ++i) //j = pi[i-1] at the beginning of every iter... | /content/code_sandbox/strings/PrefixAutomaton.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 334 |
```java
package strings;
public class SuffixTrie {
static final int R = 26; //Alphabet (lowercase etters in below implementation)
static class Node { Node[] next = new Node[R]; int val = -1; }
Node root = new Node();
void put(char[] s, int idx) // O(n) where n = |s|. Can be implemented recursively
{
... | /content/code_sandbox/strings/SuffixTrie.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 216 |
```java
package strings;
import java.util.Arrays;
public class AhoCorasick {
static final int k = 26;
static class Node
{
int p, c, link = -1;
boolean leaf;
Node(int a, int b) { p = a; c = b; }
int[] next = new int[26], go = new int[26];
{
Arrays.fill(next, -1);
Arrays.fill(go, -1);
}
}... | /content/code_sandbox/strings/AhoCorasick.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 381 |
```java
package strings;
public class Manacher {
static int[][] manacher(char[] s)
{
int n = s.length, d1[] = new int[n], d2[] = new int[n];
//Calculation of odd-length palindromes
for(int i = 0, l = 0, r = -1; i < n; ++i)
{
int k = i > r ? 1 : Math.min(r - i + 1, d1[l + r - i]);
while(i + k < n && i... | /content/code_sandbox/strings/Manacher.java | java | 2016-05-29T16:04:20 | 2024-08-15T19:22:08 | Competitive-programming-library | AhmadElsagheer/Competitive-programming-library | 2,432 | 357 |
```python
#!/usr/bin/env python3
# This is free and unencumbered software released into the public
# domain.
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a
# compiled binary, for any purpose, commercial or non-commercial, and
# by any m... | /content/code_sandbox/update-readmes.py | python | 2016-05-29T15:31:22 | 2024-08-13T08:27:57 | python-tutorial | Akuli/python-tutorial | 1,350 | 834 |
```python
#!/usr/bin/env python3
# This is free and unencumbered software released into the public
# domain.
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a
# compiled binary, for any purpose, commercial or non-commercial, and
# by any m... | /content/code_sandbox/linkcheck.py | python | 2016-05-29T15:31:22 | 2024-08-13T08:27:57 | python-tutorial | Akuli/python-tutorial | 1,350 | 1,125 |
```python
# This is free and unencumbered software released into the public
# domain.
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a
# compiled binary, for any purpose, commercial or non-commercial, and
# by any means.
# In jurisdiction... | /content/code_sandbox/common.py | python | 2016-05-29T15:31:22 | 2024-08-13T08:27:57 | python-tutorial | Akuli/python-tutorial | 1,350 | 1,130 |
```css
/* This file is used by the HTML files that make-html.py creates.
Customize this if you want to create HTML files with different
colors. See also make-html.py's --pygments-style option. */
body {
color: white;
background-color: #222222;
}
a {
color: orange;
}
``` | /content/code_sandbox/html-style.css | css | 2016-05-29T15:31:22 | 2024-08-13T08:27:57 | python-tutorial | Akuli/python-tutorial | 1,350 | 70 |
```python
#!/usr/bin/env python3
# This is free and unencumbered software released into the public
# domain.
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a
# compiled binary, for any purpose, commercial or non-commercial, and
# by any m... | /content/code_sandbox/update-ends.py | python | 2016-05-29T15:31:22 | 2024-08-13T08:27:57 | python-tutorial | Akuli/python-tutorial | 1,350 | 1,097 |
```python
#!/usr/bin/env python3
# This is free and unencumbered software released into the public
# domain.
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a
# compiled binary, for any purpose, commercial or non-commercial, and
# by any m... | /content/code_sandbox/make-html.py | python | 2016-05-29T15:31:22 | 2024-08-13T08:27:57 | python-tutorial | Akuli/python-tutorial | 1,350 | 2,181 |
```javascript
// Registry find library
var Registry = function(iTree, sComputerName) {
this.iTree = (iTree || Registry.HKEY_LOCAL_MACHINE);
this.sComputerName = (sComputerName || '.');
var locStr = 'winmgmts:{impersonationLevel=impersonate}//'
+ this.sComputerName
+ '/root/default:StdRe... | /content/code_sandbox/_puttycolor.js | javascript | 2016-04-01T10:00:42 | 2024-08-13T21:14:19 | putty-color-themes | AlexAkulov/putty-color-themes | 1,115 | 1,361 |
```yaml
pev:
build: .
ports:
- "8000:8000"
volumes:
- ./:/var/www/pev/
``` | /content/code_sandbox/docker-compose.yml | yaml | 2016-01-04T01:19:52 | 2024-08-15T22:13:36 | pev | AlexTatiyants/pev | 2,757 | 34 |
```javascript
// Turn on full stack traces in errors to help debugging
Error.stackTraceLimit=Infinity;
jasmine.DEFAULT_TIMEOUT_INTERVAL = 100;
// Cancel Karma's synchronous start,
// we will call `__karma__.start()` later, once all the specs are loaded.
__karma__.loaded = function() {};
System.config({
baseURL: '/... | /content/code_sandbox/test-main.js | javascript | 2016-01-04T01:19:52 | 2024-08-15T22:13:36 | pev | AlexTatiyants/pev | 2,757 | 341 |
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title><%= APP_TITLE %></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- inject:css -->
<!-- endinject -->
</he... | /content/code_sandbox/app/index.html | html | 2016-01-04T01:19:52 | 2024-08-15T22:13:36 | pev | AlexTatiyants/pev | 2,757 | 172 |
```javascript
// Karma configuration
// Generated on Wed Jul 15 2015 09:44:02 GMT+0200 (Romance Daylight Time)
'use strict';
module.exports = function(config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: './',
// frameworks to use
// availabl... | /content/code_sandbox/karma.conf.js | javascript | 2016-01-04T01:19:52 | 2024-08-15T22:13:36 | pev | AlexTatiyants/pev | 2,757 | 713 |
```html
<div class="page">
<button class="pull-right btn btn-link" (click)="prefill()">create a sample plan</button>
<span class="text-muted">For best results, use <code>EXPLAIN (ANALYZE, COSTS, VERBOSE, BUFFERS, FORMAT JSON)</code><br>
Psql users can export the plan to a file using <code>psql -qAt -f expl... | /content/code_sandbox/app/components/plan-new/plan-new.html | html | 2016-01-04T01:19:52 | 2024-08-15T22:13:36 | pev | AlexTatiyants/pev | 2,757 | 276 |
```html
<div class="plan-node"
[class.expanded]="showDetails"
[class.compact]="viewOptions.viewMode === viewModes.COMPACT"
[class.dot]="viewOptions.viewMode === viewModes.DOT">
<header (click)="showDetails = !showDetails" tooltip="view node details">
<h4>{{getNodeName()}}</h4>
<span *ngIf="view... | /content/code_sandbox/app/components/plan-node/plan-node.html | html | 2016-01-04T01:19:52 | 2024-08-15T22:13:36 | pev | AlexTatiyants/pev | 2,757 | 1,204 |
```html
<div class="page">
<div class="hero-container" *ngIf="plans.length === 0">
Welcome to PEV! Please <a [routerLink]="['/PlanNew']">submit</a> a plan for visualization
</div>
<table class="table pad-bottom">
<tr *ngFor="#plan of plans">
<!-- this is a hack that should be converted to a pro... | /content/code_sandbox/app/components/plan-list/plan-list.html | html | 2016-01-04T01:19:52 | 2024-08-15T22:13:36 | pev | AlexTatiyants/pev | 2,757 | 334 |
```html
<div class="menu" [class.menu-hidden]="hideMenu">
<header>
<i class="fa fa-cogs menu-toggle" (click)="hideMenu = !hideMenu"></i>
<h3>display options</h3>
</header>
<ul>
<li>
<input id="showPlanStats" type="checkbox" [(ngModel)]="viewOptions.showPlanStats">
<label cl... | /content/code_sandbox/app/components/plan-view/plan-view.html | html | 2016-01-04T01:19:52 | 2024-08-15T22:13:36 | pev | AlexTatiyants/pev | 2,757 | 1,013 |
```html
<div class="page page-content">
<h2>Postgres EXPLAIN Visualizer (Pev)</h2>
<p>
Pev is designed to make <a href="path_to_url">
Postgres query plans</a> easier to grok. It displays a plan as a tree, with each node representing a step that takes in a row set
and produces another. Pev can sh... | /content/code_sandbox/app/components/about/about.html | html | 2016-01-04T01:19:52 | 2024-08-15T22:13:36 | pev | AlexTatiyants/pev | 2,757 | 546 |
```html
<nav>
<div class="nav-container">
<a class="about"[routerLink]="['About']">about</a>
<a class="btn btn-primary btn-lg pull-right" [routerLink]="['PlanNew']">new plan</a>
<a [routerLink]="['PlanList']">plans</a>
</div>
</nav>
<router-outlet></router-outlet>
<footer><strong>pev</strong> ... | /content/code_sandbox/app/components/app/app.html | html | 2016-01-04T01:19:52 | 2024-08-15T22:13:36 | pev | AlexTatiyants/pev | 2,757 | 162 |
```scss
$menu-offset: 120px;
$menu-toggle-height: 45px;
.menu {
width: 190px;
height: 260px;
position: absolute;
font-size: $font-size-sm;
top: $menu-offset - 5;
left: 0;
background-color: $gray-dark;
box-shadow: 1px 1px 2px 1px rgba(0,0,0,0.2);
color: #fff;
border-top-right-radius: $bord... | /content/code_sandbox/app/assets/sass/_menu.scss | scss | 2016-01-04T01:19:52 | 2024-08-15T22:13:36 | pev | AlexTatiyants/pev | 2,757 | 356 |
```scss
.page {
padding-top: $padding-lg;
margin: auto;
width: $page-width;
min-height: 600px;
em {
font-style: italic;
}
}
.page-content {
h2 {
font-size: round($font-size-base * 2);
line-height: 2;
}
h3 {
font-size: round($font-size-base * 1.7);
margin-top: $p... | /content/code_sandbox/app/assets/sass/_page.scss | scss | 2016-01-04T01:19:52 | 2024-08-15T22:13:36 | pev | AlexTatiyants/pev | 2,757 | 260 |
```scss
.plan-node {
text-decoration: none;
color: $text-color;
display: inline-block;
transition: all 0.1s;
position: relative;
padding: $padding-base $padding-lg;
background-color: #fff;
font-size: $font-size-sm;
border: 1px solid $line-color;
margin-bottom: 4px;
border-radius: $border-radius... | /content/code_sandbox/app/assets/sass/_plan-node.scss | scss | 2016-01-04T01:19:52 | 2024-08-15T22:13:36 | pev | AlexTatiyants/pev | 2,757 | 789 |
```scss
.modal-backdrop {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 1040;
background-color: #000;
opacity: 0.1;
}
.modal {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 1050;
transition: all 1s;
.modal-dialog {
posit... | /content/code_sandbox/app/assets/sass/_modal.scss | scss | 2016-01-04T01:19:52 | 2024-08-15T22:13:36 | pev | AlexTatiyants/pev | 2,757 | 311 |
```scss
.plan-query-container {
border: 1px solid $line-color;
padding: $padding-xl;
background-color: #fff;
position: absolute;
box-shadow: 0px 0px 10px 2px rgba(0,0,0,0.3);
border-radius: $border-radius-base;
margin-bottom: $padding-xl;
z-index: 6;
left: 0;
code {
font-weight: 300... | /content/code_sandbox/app/assets/sass/_highlight.scss | scss | 2016-01-04T01:19:52 | 2024-08-15T22:13:36 | pev | AlexTatiyants/pev | 2,757 | 496 |
```scss
@import "compass/css3/user-interface";
.input-box {
@include input-placeholder {
color: $gray;
font-size: round($font-size-base * 1.4);
}
&:focus {
box-shadow: 0 0 5px rgba(81, 203, 238, 1);
}
&-main {
font-size: round($font-size-base * 1.4);
width: 700px;
border: 0;
bor... | /content/code_sandbox/app/assets/sass/_forms.scss | scss | 2016-01-04T01:19:52 | 2024-08-15T22:13:36 | pev | AlexTatiyants/pev | 2,757 | 230 |
```scss
footer {
border-top: 2px solid $gray-light;
margin: round($padding-lg * 2);
padding: round($padding-lg * 2);
color: $gray;
text-align: center;
width: 600px;
margin: auto;
.fa {
font-size: $font-size-lg;
margin-left: $padding-base;
}
}
``` | /content/code_sandbox/app/assets/sass/_footer.scss | scss | 2016-01-04T01:19:52 | 2024-08-15T22:13:36 | pev | AlexTatiyants/pev | 2,757 | 85 |
```scss
html {
height: 100%;
}
body {
font-size: $font-size-base;
font-weight: 300;
color: $text-color;
height: 100%;
width: 100%;
background-color: $bg-color;
line-height: $line-height-base;
}
strong {
font-weight: 600;
}
body, input, a, button, textarea {
font-family: $font-family-sans-serif;
font-weigh... | /content/code_sandbox/app/assets/sass/_common.scss | scss | 2016-01-04T01:19:52 | 2024-08-15T22:13:36 | pev | AlexTatiyants/pev | 2,757 | 379 |
```scss
.table {
width: 100%;
td {
border-bottom: 1px solid $line-color;
padding: $padding-base;
}
tr:hover {
background-color: $gray-lightest;
}
}
``` | /content/code_sandbox/app/assets/sass/_table.scss | scss | 2016-01-04T01:19:52 | 2024-08-15T22:13:36 | pev | AlexTatiyants/pev | 2,757 | 50 |
```scss
@import "compass/reset";
@import "font-awesome/styles";
@import "variables";
@import "fonts";
@import "common";
@import "buttons";
@import "forms";
@import "nav";
@import "plan";
@import "plan-node";
@import "menu";
@import "page";
@import "table";
@import "modal";
@import "footer";
@import "highlight";
``` | /content/code_sandbox/app/assets/sass/styles.scss | scss | 2016-01-04T01:19:52 | 2024-08-15T22:13:36 | pev | AlexTatiyants/pev | 2,757 | 85 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.