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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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 hidden characters
{ | |
"cmd": ["nasm", "-f", "macho64", "${file}"], | |
"file_regex": "a(sm)?$", | |
"working_dir": "${file_path}", | |
"selector": "untitled.asm", | |
"variants": | |
[ | |
{ |
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
public class InvokeDynamicTest { | |
public static void main(String[] args) { | |
Runnable x = () -> { | |
}; | |
} | |
} |
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
//java -Xms20M -Xmx20M -Xmn10M -XX:SurvivorRatio=8 -XX:PermSize=32M -XX:MaxPermSize=64M -XX:+PrintGCDetails -XX:+HeapDumpOnOutOfMemoryError -Xloggc:oom.log HeapOOM | |
import java.util.*; | |
public class HeapOOM { | |
public static void main(String[] args) { | |
List list = new ArrayList(); | |
int count = 0; | |
while(true) { | |
count++; | |
OOMObject o = new OOMObject("objname" + count); | |
if(count%10000==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
public static String getLocalAddress() { | |
try { | |
// Traversal Network interface to get the first non-loopback and non-private address | |
Enumeration<NetworkInterface> enumeration = NetworkInterface.getNetworkInterfaces(); | |
ArrayList<String> ipv4Result = new ArrayList<String>(); | |
ArrayList<String> ipv6Result = new ArrayList<String>(); | |
while (enumeration.hasMoreElements()) { | |
final NetworkInterface networkInterface = enumeration.nextElement(); | |
final Enumeration<InetAddress> en = networkInterface.getInetAddresses(); | |
while (en.hasMoreElements()) { |
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
user root; | |
worker_processes 1; | |
#error_log logs/error.log; | |
#error_log logs/error.log notice; | |
#error_log logs/error.log info; | |
#pid logs/nginx.pid; | |
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
public class KMP { | |
public static void main(String[] args) { | |
String source = "ababababcaab"; | |
String target = "abababca"; | |
KMP kmp = new KMP(); | |
int[] result = kmp.preProcess(target); | |
for(int i=0; i<result.length; i++) { | |
System.out.println(result[i]); | |
} |
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
public class ABA { | |
private static int count = 0; | |
public static void main(String[] args) throws Exception { | |
ABA aba = new ABA(); | |
aba.increase(); | |
Thread.sleep(10000); | |
System.out.println(count); | |
} | |
public void increase() { |
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 main | |
import ( | |
"fmt" | |
) | |
func main() { | |
data := "A\xfe\x02\xff\x04" | |
for _, v := range data { | |
fmt.Printf("%#x ", v) //0x41 0xfffd 0x2 0xfffd 0x4 |
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
import java.io.*; | |
import java.util.*; | |
import sun.jvm.hotspot.memory.*; | |
import sun.jvm.hotspot.oops.*; | |
import sun.jvm.hotspot.debugger.*; | |
import sun.jvm.hotspot.runtime.*; | |
import sun.jvm.hotspot.tools.*; | |
import sun.jvm.hotspot.utilities.*; | |
public class DirectMemorySize extends Tool { |
OlderNewer