Skip to content

Instantly share code, notes, and snippets.

View jorgedfbranco's full-sized avatar

Jorge Branco jorgedfbranco

  • Zurich, Switzerland
View GitHub Profile

Building the JDK and getting the HotSpot sources loaded into CLion

As I've already found myself more than once going through the steps of building the JDK on my Ubuntu machine and getting the Hotspot's source loaded into CLion, I ended up deciding to assemble this document to help me or others in the future, would the need eventually arise.

Building the JDK should be relatively painless, and when problems arise the tools are in generally very specific about what's wrong. In the worst of scenarios, a simple google search will most likely suffice. But as there are at least some things we should be wary about, I'm writing this simple tutorial down. In case you get stuck or if you need a more thorough guide, I highly recommend https://github.com/openjdk/jdk/blob/master/doc/building.md.

Getting the Hotspot code on CLion should also be straightforward, as long as you understand that due to macros / templates and the way code is separated (shared, os-specific, architecture-specific, etc), the experience will ne

public static List<Integer> rabinKarp(String s, String p) {
int ph = 0;
for (int i = 0; i < p.length(); i++) {
char c = p.charAt(i);
ph = ph*31 + c;
}
List<Integer> results = new ArrayList<>();
int sh = 0;
for (int i = -p.length()+1; i < s.length()-p.length()+1; i++) {

Bash Cheat Sheet

curl

  • Pass in username/password: -u username:password, to use github tokens, curl -u 2346b76ab68d28071961d15e96e89d09614bec97:x-oauth-basic
  • Passing in HTTP headers: -h "A: B", such as -h "Autorization: bearer ABC
  • Post a message in the body of curl: --data "contents" or -d "contents"
  • curl will by default assume it's dealing with a GET, unless a -d is passed in, then being considered a POST. To explicitly state which request method you want, you can pass in -X PUT, -X HEAD, etc.
  • Follow redirects: -L
  • Avoid reporting download information: -s
  • Extra information: -v, -i
Jorge's Linux Cheat Sheet
Terminal's Shortcuts (full list @ http://www.skorks.com/2009/09/bash-shortcuts-for-maximum-productivity/):
CTRL+A - Move the caret to the beginning of line.
CTRL+E - Move the caret to the end of line.
CTRL+U - Remove all the chars between the current caret position and the beginning of the line.
ALT+B - Move to the beginning of the previous word.
ALT+F - Move to the beginning of the next word.
CTRL+W - Delete word before cursor.
CTRL+D - Close shell if the current line is empty or delete current char.
http://www.newlyswissed.com/top-6-most-unique-roads-in-switzerland/
http://www.myswitzerland.com/en-ch/top_attracties/
http://www.expatica.com/ch/out-and-about/Top-10-places-to-visit-in-Switzerland_102301.html
http://www.myswitzerland.com/en-ch/interests/excursion-summer/zoos-wildlife-parks/nocturama-tropical-gardens2.html
sbt update-classifiers <- download all javadoc/sources for all dependencies
F2 / SHIFT+F2 -> Next / Previous error in the currently opened file
CTRL + F12 -> View file's methods
CTRL + (SHIFT +) E -> Recently (edited) files
SHIFT, SHIFT -> Search everywhere
http://i.stack.imgur.com/BlpRb.png
whatis / whereis / which
ls
red results -> broken symlink
Get return value of last executed command: echo $?
History:
--all searches over the entire repository instead of only in the current branch
- git log --oneline (compressed, one line for commit)
- git log --grep <regex> (searches for commits with the given regex expression in their message)
- git log -Smysearchstring (searches for all the commits that contain any change for mysearchstring in this branch, that is, it looks at
files contents, not to commit messages.)
- git log --pretty=format:"%Cgreen%h %Cred%cn %Cblue%s"
  - git log --pretty=format:"%<|(20) %Cgreen%h %Cred%cn %Cblue%s" (with column)
<!DOCTYPE html>
<html>
<head>
<title>Register Account</title>
<script>
function form_submit() {
alert('submitting!')
}
</script
</head>