Skip to content

Instantly share code, notes, and snippets.

function MyObject(val) {
this.val = val;
this.myCallback = this.myCallback.bind(this); // or lodash.bindall(this, 'myCallback');
}
MyObject.prototype.myCallback = function(err, data){
console.log(err,data);
console.log(this.val);
};
@muromec
muromec / latynka
Last active September 2, 2015 14:26
default partial alphanumeric_keys
xkb_symbols "latin" {
include "latin"
name[Group1]= "Ukrainian (latin)";
key <AC02> { [ s, S, scaron, Scaron ] };
key <AB01> { [ z, Z, zcaron, Zcaron ] };
key <AB03> { [ c, C, ccaron, Ccaron ] };
key <AD08> { [ i, I, idiaeresis, Idiaeresis ] };
include "level3(ralt_switch)"
@muromec
muromec / keybase.md
Created September 23, 2014 09:26
keybase.md

Keybase proof

I hereby claim:

  • I am muromec on github.
  • I am muromec (https://keybase.io/muromec) on keybase.
  • I have a public key whose fingerprint is 2716 F175 82CF 9833 DD1D D244 9180 15F3 1BE0 0922

To claim this, I am signing this object:

@muromec
muromec / implicit_parent_bug.js
Last active August 29, 2015 14:02
ASN1.js bug
var asn1 = require('asn1.js');
var broken = function() {
var B = asn1.define('B', function() {
this.seq().obj( // NO implicit tag here
this.key('b').octstr()
);
});
var A = asn1.define('Bug', function() {
#include "stdio.h"
#include "string.h"
#include "gost89.h"
#include "gosthash.h"
#include "util.h"
#include <fcntl.h>
#include <sys/types.h>
#include <sys/uio.h>
#include <unistd.h>
@muromec
muromec / reader.c
Created May 8, 2014 18:20
Fuck. This. Crypto.
input_fd = open("key.dat", O_RDONLY);
if(input_fd < 0) {
fprintf(stderr, "failed to open data file\n");
return 1;
}
lseek(input_fd, 38, SEEK_SET);
memset(data, 0, 1024);
have = read(input_fd, data, 1024);
if(have < 100) {
@muromec
muromec / texr_version.py
Created July 13, 2013 08:55
query texr.net version
mport socket
msg = '''OPTIONS sip:texr.net SIP/2.0
Via: SIP/2.0/UDP texr.net;branch=z9hG4bK5cb072362f08f6a3
Content-Length: 0
From: "neko" <sip:neko@texr.net>;tag=4158f3dc
To: "neko" <sip:neko@texr.net>
User-Agent: pygay
CSeq: 55216 OPTIONS
Max-Forwards: 70
@muromec
muromec / ReIpc.java
Created July 9, 2013 17:26
JavaHell
package net.texr.mobile;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import org.msgpack.MessagePack;
import org.msgpack.packer.Packer;
import org.msgpack.type.Value;
import os
import msgpack
import socket
def cmd(name):
def cmd(f):
f._cmd_name = name
return f
return cmd
#!/bin/sh
set -e
CLI=./cli
if [ ! -e ~/.texr.cert ]; then
TD=$(mktemp -d)
openssl genrsa 2048 > ${TD}/key.priv 2> /dev/null
openssl rsa -in ${TD}/key.priv -pubout -out ${TD}/key.pub 2>/dev/null