For KVM and Laptop
I want full control what boots the computer to avoid the so called evil maid attack. That requires setting SecureBoot with only my own keys.
/* Author: Francisco Aranda (farandal@gmail.com) */ | |
package controllers; | |
import org.apache.http.HttpHost; | |
import org.apache.http.HttpResponse; | |
import org.apache.http.NameValuePair; | |
import org.apache.http.auth.AuthScope; | |
import org.apache.http.auth.UsernamePasswordCredentials; | |
import org.apache.http.client.entity.UrlEncodedFormEntity; |
package controllers; | |
import com.google.gson.*; | |
import com.google.gson.reflect.TypeToken; | |
import play.*; | |
import play.api.libs.json.JsValue; | |
import play.api.libs.json.Json; | |
import play.api.templates.*; | |
import play.mvc.*; |
(module | |
(func $addTwo (param i32 i32) (result i32) | |
(i32.add | |
(get_local 0) | |
(get_local 1))) | |
(export "addTwo" (func $addTwo))) |
## Java | |
sudo apt-get update | |
sudo apt-get install default-jdk | |
## Scala | |
sudo apt-get remove scala-library scala | |
sudo wget http://scala-lang.org/files/archive/scala-2.12.1.deb | |
sudo dpkg -i scala-2.12.1.deb | |
sudo apt-get update | |
sudo apt-get install scala |
For KVM and Laptop
I want full control what boots the computer to avoid the so called evil maid attack. That requires setting SecureBoot with only my own keys.
The other day, I was wondering why Clojure fits my brain so well. I think I was relaxing on my old couch, drinking cheap beer, eating a gas station pastry, and drawing doodles on a stack of overdue bills I forgot to pay. Little did I realize, these things are all connected.
I have a hypothesis that people choose programming languages based on their personality. For the purposes of this write-up, I’ll use the well-known distinction between type A and type B people. This may be pop psychology stuff, but it’s convenient for my point so in the spirit of American politics I will treat it as fact.
Type A people are very organized, competitive, punctual, and like to plan ahead. When I was a kid, these were the ones who had perfect grades, competed in track or swimming, and on top of that they were nice people so I couldn't even hate the fuckers. Type B people, on the other hand, are laid back and like to do things spontaneously. Like The Dude from The Big Lebowski, they are comfortable with
val factorialOfFive = {1 to 5}.toList.reduceLeft(_*_) |
Here are 10 one-liners which show the power of scala programming, impress your friends and woo women; ok, maybe not. However, these one liners are a good set of examples using functional programming and scala syntax you may not be familiar with. I feel there is no better way to learn than to see real examples.
Updated: June 17, 2011 - I'm amazed at the popularity of this post, glad everyone enjoyed it and to see it duplicated across so many languages. I've included some of the suggestions to shorten up some of my scala examples. Some I intentionally left longer as a way for explaining / understanding what the functions were doing, not necessarily to produce the shortest possible code; so I'll include both.
The map
function takes each element in the list and applies it to the corresponding function. In this example, we take each element and multiply it by 2. This will return a list of equivalent size, compare to o
#!/usr/bin/env bash | |
export WINEDEBUG=-all | |
WINE=/usr/local/bin/wine | |
SPW=$HOME/.wine/drive_c/Program\ Files/SigmaPlot/SPW12/Spw.exe | |
if [ -z "$1" ]; then | |
"$WINE" "$SPW" >& /dev/null & | |
else |
package ru.inspirit.asfeat.struct | |
{ | |
/** | |
* Simple but fast Dual Linked List approach | |
* Core implementation idea grabbed from Linux Kernel C source | |
* | |
* @author Eugene Zatepyakin | |
*/ | |
public final class LList | |
{ |