Skip to content

Instantly share code, notes, and snippets.

View belukov's full-sized avatar

Aleksey Belukov belukov

View GitHub Profile
#!/bin/bash
TARGET=${1:?"Usage $0 <path to root dir>"}
find $TARGET -type d -exec chmod a+rx {} +
@belukov
belukov / offline-sign-verify.js
Last active March 5, 2024 21:33
eth offline sign and verify message (without web3)
const ethUtils = require('ethereumjs-util');
const privateKey = '0x3c9229289a6125f7fdf1885a77bb12c37a8d3b4962d936f7e3084dece32a3ca1'
const message = 'hello world';
function sign(message, pkey) {
let mHash = ethUtils.sha3(message);
let keyBuf = new Buffer(pkey.slice(2), 'hex');
let vrs = ethUtils.ecsign(mHash, keyBuf);
0x6449dc27bfe45F4a45b9784D8f511CeB2270348C
db.getCollectionNames().forEach( function (collection) {
print('col: ', collection);
if(0 === collection.indexOf('acl_allows_')) {
db[collection].drop();
print("drop'd");
}
});
gs=`git status 2>&1`;
#echo "gs: '$gs'";
echo "";
if [[ $gs =~ 'Not a git repository' ]]; then
echo "No git";
pwd
exit 1;
fi
alias чокак='git status'
alias естьчо='git pull'
alias нака='git push'
alias нунах='git reset —hard'
@belukov
belukov / get pid by port
Last active August 3, 2016 14:30
get pid by port
netstat -antp | grep :::9999 | sed 's/.* \([0-9][0-9]*\)\/node/\1/'
(function(localCallback) {
if(curCategory) {
curCategory.getChilds(function (err, childs) {
// ...
var conds = {};
// ... many code for cimplicated conds ...
return localCallback(null, conds);
})
} else {
@belukov
belukov / .vimrc
Last active February 8, 2018 15:42
syntax on
set nocompatible
filetype off
set rtp+=~/.vim/bundle/vundle/
call vundle#begin()
Plugin 'tomlion/vim-solidity'
call vundle#end()
filetype plugin indent on
" To ignore plugin indent changes, instead use:
@belukov
belukov / bx_cron_events.php
Last active April 2, 2016 13:33
bitrix cron_events.php (bitrix/php_interface/cron_events.php)
<?php
$_SERVER["DOCUMENT_ROOT"] = realpath(dirname(__FILE__)."/../..");
$DOCUMENT_ROOT = $_SERVER["DOCUMENT_ROOT"];
define("NO_KEEP_STATISTIC", true);
define("NOT_CHECK_PERMISSIONS",true);
define('BX_NO_ACCELERATOR_RESET', true);
define('CHK_EVENT', true);