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._ | |
@SerialVersionUID(15L) | |
class Animal(name: String, age: Int) extends Serializable { | |
override def toString = s"Animal($name, $age)" | |
} | |
case class Person(name: String) | |
// or fork := true in sbt |
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
#!/bin/bash | |
socat -v -T0.05 tcp-l:8081,reuseaddr,fork system:"echo 'HTTP/1.1 200 OK'; echo 'Connection: close'; echo; cat" |
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
#!/bin/bash | |
# Depends on git, curl, jq | |
BAK_DIR=$(date +"%y%m%d-%H%M") | |
GISTS_URL="https://api.github.com/users/$USER/gists?per_page=1000&access_token=$GITHUB_ACCESS_TOKEN" | |
mkdir "$BAK_DIR" && cd "$BAK_DIR" && curl -s "$GISTS_URL" | jq ".[] | .git_pull_url" | xargs -n1 git clone |
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
#!/bin/bash | |
FILE="$1" | |
PORT=${PORT:-9999} | |
MIME_TYPE=$(mimetype "$FILE") | |
SIZE_BYTES=$(du -b "$FILE" | cut -f1) | |
FILE_NAME=$(basename "$FILE") | |
HEADER="\ | |
HTTP/1.1 200 OK |
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 time.sleep | |
import zmq | |
context = zmq.Context() | |
socket = context.socket(zmq.PUB) | |
socket.bind('tcp://127.0.0.1:2000') | |
# Allow clients to connect before sending data | |
sleep(10) | |
socket.send_pyobj({1:[1,2,3]}) |
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
/* | |
CHANGELOG | |
- add annotation for param names | |
*/ | |
import javax.jws.{WebService, WebParam} | |
import javax.jws.soap.SOAPBinding | |
import SOAPBinding.Style | |
import javax.xml.ws.Endpoint |
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
## | |
## IMAP CREDENTIALS | |
## | |
set smtp_url = "smtp://some_user@smtp.gmail.com:587/" | |
#set smtp_pass = "password" | |
set from = "someuser@example.com" | |
set realname = "Some User" | |
## | |
## IMAP SETTINGS |
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
def getUnsafeInstance: sun.misc.Unsafe = { | |
val f = classOf[sun.misc.Unsafe].getDeclaredField("theUnsafe") | |
f.setAccessible(true) | |
val unsafe = f.get(null).asInstanceOf[sun.misc.Unsafe] | |
unsafe | |
} |
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
#!/bin/bash | |
# | |
# Build shell command completions | |
# | |
function _build_completions { | |
local current_word | |
COMPREPLY=() | |
current_word=${COMP_WORDS[COMP_CWORD]} |
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
### Sending a file | |
# BSD nc syntax | |
cat myDocument.pdf | ssh me.myserver.com nc -l 20000 | |
# Hobbit nc syntax - try this one if unsure! | |
cat myDocument.pdf | ssh me.myserver.com nc -l -p 20000 | |
### Receiving a file | |
nc me.myserver.com 20000 > myDocument.pdf |
NewerOlder