Skip to content

Instantly share code, notes, and snippets.

@nvasilakis
nvasilakis / screen.md
Last active June 2, 2020 20:34 — forked from fredrick/screen.md
GNU Screen Cheat Sheet

GNU Screen Cheat Sheet

Basics

Remember: in screen, all screen-related commands are prefixed by ctr-a (which means pressing ctrl and a together, and then pressing the followup character).

The 4 most basic commands (if you're new to screen, learn only these):

  • ctrl-a c -> create­ate new window
  • ctrl-a ctrl-a -> toggle between latest windows
  • ctrl-a " -> show all windows and choose using up/down arrows
  • ctrl-a d -> detach window
@nvasilakis
nvasilakis / partial-package.json
Created September 19, 2017 20:33 — forked from brianloveswords/partial-package.json
TypeScript autobuild and copy to clipboard. Useful for developing stuff where you can't actually access the content directly in a text editor (e.g. tampermonkey)
{
"scripts": {
"build": "tsc && npm run post-build",
"watch": "tsc-watch --onSuccess 'npm run post-build'",
"post-build": "rollup build/index.js --o build/bundle.js --f iife && cat src/prelude.js build/bundle.js | (pbcopy && osascript -e 'display notification \"Script copied to clipboard\" with title \"Script Builder\"' || echo 'copied script to clipboard')"
}
}
@nvasilakis
nvasilakis / 0.unsafe.js
Last active August 29, 2017 00:18
A minimal "vuln" example
x = "thisIsASecret";
function unsafeMain () {
var v = require('./0.vuln.js');
v.f()
}
unsafeMain();
@nvasilakis
nvasilakis / cc.js
Created July 31, 2017 00:05
color-console.js
// http://stackoverflow.com/questions/7505623/colors-in-javascript-console
// https://github.com/adamschwartz/log
// color-console
(function() {
var exportedLog, ffSupport, formats, getOrderedMatches, hasMatches, isFF,
isIE, isOpera, isSafari, log, makeArray, operaSupport, safariSupport,
stringToArgs, _log;
if (!(window.console && window.console.log)) {
return;
@nvasilakis
nvasilakis / memoize.js
Last active February 26, 2017 00:23
Cool prototype patching
function memoize(fun) {
// memoize a function with arbitrary arguments
var memo = {}
var name = fun.name || "anonymous";
return function memoize_fun() {
this.name = this.name + "__" + name;
var args = arguments;
var sargs = JSON.stringify(args);
if (memo[sargs]) {
return memo[sargs];
@nvasilakis
nvasilakis / Dockerfile
Created January 10, 2017 05:49 — forked from christianberg/Dockerfile
Sharing a unix socket between a Docker container and it's host
FROM ubuntu
RUN apt-get update
RUN apt-get install -y socat
VOLUME /foo
CMD socat UNIX-LISTEN:/foo/bar.sock -
/*
A simple new-line delimited JSON protocol with upgrades.
Receiving Usage:
protocol = require('./frame-protocol');
// parsing data
parser = protocol.Parser();
@nvasilakis
nvasilakis / object.js
Created July 18, 2015 20:14
A mini tutorial on JavaScript objects and inheritance
/**
* A mini tutorial on JavaScript Object Inheritance
*
* API myPerson = person.create() creates a person object
* myPerson.id set/get ID
* myPerson.name set/get name
* myPerson.age set/get age
* myPerson.salute() return a salute (incl. name)
* person.staticSalute() returns a static salute (no name)
*
import java.io.IOException;
import java.util.StringTokenizer;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.Reducer;
@nvasilakis
nvasilakis / 100.txt
Last active August 29, 2015 14:04
A synthetic memory allocation benchmark
1000 8 985 8 0
2000 0 999 0 0
3000 1 996 1 0
4000 14 981 14 0
5000 32 964 32 0
6000 40 955 40 0
7000 33 963 33 0
8000 39 956 39 0
9000 36 959 36 0
10000 36 960 36 0