Skip to content

Instantly share code, notes, and snippets.

View ypetya's full-sized avatar
💭
🚀

Peter Kiss ypetya

💭
🚀
  • Budapest, Hungary
View GitHub Profile
@ypetya
ypetya / Drawer.js
Last active April 26, 2018 16:18
Steganography
var VERSION = 2;
function Drawer(canvas) {
this.canvas = canvas;
this.width = canvas.width;
this.height = canvas.height;
this.ctx = canvas.getContext("2d");
this.imageData = this.ctx.createImageData(1, 1);
}
(;; my block
(let (
(str "string!")
(local_list (list 1 2 3)))
(message "This is a string %s" str) ;; prints to *Message* buffer
(message "This is a list %S" local_list)
nil
) ;; => returns nil
;; from emacs 24 eslip simulates lexical scoping though it has
@ypetya
ypetya / lodash4UnsetPolyfill.js
Created October 21, 2016 16:10
Quick an' dirty polyfill for lodash4 unset
function unset(o,path) {
if(path.indexOf('.')==-1) {
delete o[path];
} else {
var o2=path.split('.'),
ending=o2.pop();
unset(o[o2],ending);
}
}
@ypetya
ypetya / bind.js
Created October 14, 2016 13:15
bind freezing this
var a = function(a,b,c){ console.log( this.toString(),a,b,c); }
a(1,2,3)
// => [object Window] 1 2 3
var b = a.bind(1,2)
b(3,4)
// => 1 2 3 4
var c = b.bind(3,4)
c(5,6)
// => 1 2 4 5
b === c
@ypetya
ypetya / NewServlet.java
Last active October 13, 2016 14:38
minimal in-memory session state
package example;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;

Keybase proof

I hereby claim:

  • I am ypetya on github.
  • I am ypetya (https://keybase.io/ypetya) on keybase.
  • I have a public key whose fingerprint is 9D19 3EEC 74AA 4092 DA73 0052 459B 3894 2ACA 4812

To claim this, I am signing this object:

@ypetya
ypetya / npm
Last active October 11, 2016 17:57
Fix out of javascript heap-memory isse for npm for mingw:npm extended with memory setupexport NODE_MEMORY=8000
#!/bin/sh
(set -o igncr) 2>/dev/null && set -o igncr; # cygwin encoding fix
basedir=`dirname "$0"`
case `uname` in
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
esac
NODE_EXE="$basedir/node.exe"
@ypetya
ypetya / secret_note.sh
Created July 27, 2016 12:08
Take a "secret" note!
#!/bin/bash
rm -f "$0.1"
while read line ; do
if [ ! -z $enc ] ; then
echo "$line" | xxd -ps -r
fi
[ -z $enc ] && [ "${line:0:2}" = '#-' ] && enc=1
if (( ${#line} > 0 )) ; then
echo $line >> "$0.1"
fi
@ypetya
ypetya / bash_test.sh
Created April 15, 2016 14:55
some basic example of usage the "test" operator
#!/bin/bash
# Erratic behavior of the "$*" and "$@" internal Bash variables,
#+ depending on whether or not they are quoted.
# Demonstrates inconsistent handling of word splitting and linefeeds.
set -- "First one" "second" "third:one" "" "Fifth: :one"
# Setting the script arguments, $1, $2, $3, etc.
@ypetya
ypetya / 2015_04 060.jpg
Last active April 1, 2016 11:27
share my things
2015_04 060.jpg