Skip to content

Instantly share code, notes, and snippets.

// Advanced Problem: Checking Whether Any Intersection in a City is Reachable from Any Other
//Task. Compute the number of strongly connected components of a given directed graph with n vertices and m edges.
// Input Format. A graph is given in the standard format.
// Constraints. 1 ≤ n ≤ 10 4 , 0 ≤ m ≤ 10 4 .
// Output Format. Output the number of strongly connected components.
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;
import java.util.Stack;
@lordfriend
lordfriend / Acylicity.java
Created May 12, 2018 16:15
Find a cycle in directed graph
import java.util.ArrayList;
import java.util.PriorityQueue;
import java.util.Scanner;
import java.util.Stack;
public class Acyclicity {
private static int acyclic(ArrayList<Integer>[] adj) {
//write your code here
boolean[] visited = new boolean[adj.length];
@lordfriend
lordfriend / login.css
Created July 30, 2016 15:03
Deneb login page hack
@media (min-width: 723px) {
.center-box {
width: 360px !important;
margin-left: 10%;
}
.center-box-header {
position: fixed;
top: 0.8rem;
@lordfriend
lordfriend / config.yml
Last active January 4, 2016 06:49
inferna mobs config file
#Chance is the chance that a mob will be infernal, the lower the number, the higher the chance.
#Enabledworlds are the worlds that infernal mobs can spawn in.
#Enabledmobs are the mobs that can become infernal.
#Loot is the items that are dropped when an infernal mob dies. (You can have up to 64)
#Item is the item, Amount is the amount, Durability is how damaged it will be (0 is undamaged).
chance: 15
#nameTagsLevel is the visibility level of the name tags, 0 = no tag,
#1 = tag shown when your looking at the mob, 2 = tag always shown.
nameTagsLevel: 2
nameTagsPrefix: "Infernal"
@lordfriend
lordfriend / config.yml
Created January 23, 2014 17:45
LeveledMobs config
distance: 50.0 #Distance in-Blocks after whichd the level increases
multiplier: 0.3 #Number to input in health algorythm
#Algorythm: MaxHealth + (MaxHealth * (trueDistance * multiplier))
expMultiplier: 0.5 #Number to input in exp algorythm
#Algorythm: BaseDroppedExp + BaseDroppedExp * (expMultiplier * lvl)
damageMultiplier: 0.1 #Number to input in damage algorythm
#Algorythm: BaseDamage + BaseDamage * (damageMultiplier * lvl)
@lordfriend
lordfriend / myController.js
Last active December 23, 2015 15:39
currently cannot read value from template attribute which is a controller define model, so change the defaultParams if you need a different init option, or you can provider a constant value to template attribute.
angular.module('myApp').controller('myController', function($scope) {
$scope.daterangeModel = {
start: moment().subtract('days', 5),
end: moment()
};
});
@lordfriend
lordfriend / task-queue
Created September 13, 2013 15:23
A javascript task queue with blocking executing in a asynchronous circumstance.
/**
* Use to execute task on an QUEUE
*/
var taskQueue = [];
var hasRunningWorker = false;
/**
* A worker which is used to running a time-consuming job.
* @param data - the data needed by the executor
@lordfriend
lordfriend / minecraft server control
Created July 29, 2013 07:57
control a server via screen on linux
#!/bin/sh
# Controls the minecraft server
#####################
#START CONFIGURATION#
#####################
# Replace the location path with the folder containing your CraftBukkit.jar or minecraft_server.jar file
LOCATION="/srv/craftbukkit"
@lordfriend
lordfriend / java env var
Created July 29, 2013 07:56
use to create environment variables for jdk
export JAVA_HOME=/usr/jdk1.6_43
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$CLASSPATH
@lordfriend
lordfriend / 360px高度
Last active December 19, 2015 00:20
G+左侧边栏图片...
.M8jNpf {
overflow: visible !important;
}
.M8jNpf::before {
position: absolute;
content: url('https://lh6.googleusercontent.com/-KK4uX4DzKDs/UcsJhmwGBtI/AAAAAAAASA8/gpFUyCTqV9Q/w219-h360-no/tsukiko_small.gif');
width: 219px;
height: 360px;
top: 0px;