Skip to content

Instantly share code, notes, and snippets.

View moshest's full-sized avatar

Moshe Simantov moshest

View GitHub Profile
ul.tagit {
padding: 1px 5px;
overflow: auto;
margin-left: inherit; /* usually we don't want the regular ul margins. */
margin-right: inherit;
}
ul.tagit li {
display: block;
float: left;
margin: 2px 5px 2px 0;
@moshest
moshest / p2p-list.md
Last active February 13, 2022 09:33
A collection of peer-to-peer decentralized projects.
@moshest
moshest / ecdh.js
Created June 25, 2015 16:50
Node.js v0.12 ECDH Example
var ecdh = crypto.createECDH('secp256k1');
ecdh.generateKeys();
var publicKey = ecdh.getPublicKey(null, 'compressed');
var privateKey = ecdh.getPrivateKey(null, 'compressed');
console.log('Private1:', privateKey.length, privateKey.toString('hex'));
console.log('Public1: ', publicKey.length, publicKey.toString('hex'));
Verifying I am +moshes on my passcard. https://onename.com/moshes
@moshest
moshest / ubuntu utils.sh
Last active December 31, 2015 06:33
Ubuntu Usful command lines
# generate private and public keys
ssh-keygen -f ~/.ssh/id_rsa -q -P ""
cat ~/.ssh/id_rsa.pub
# add some public keys
nano ~/.ssh/authorized_keys
## install basic packages
sudo apt-get -y update
sudo apt-get -y install default-jre git ImageMagick
@moshest
moshest / setup-mongodb.sh
Last active November 20, 2018 01:51
Setup Mongodb Server on Amazon EC2
#!/usr/bin/env bash
# usage: wget -N https://gist.githubusercontent.com/moshest/e4c73efc8d6a35971f6e/raw/setup-mongodb.sh && sh ./setup-mongodb.sh
set -e
# configs
read -e -p "Replica set name: " -i "rep1" replSet
read -e -p "Hostname: " -i $(curl -s http://169.254.169.254/latest/meta-data/public-hostname) hostname
read -e -p "Swap size: " -i "8G" swapsize
@moshest
moshest / install-nodejs.sh
Last active March 14, 2016 09:38
Script for installing Node.js instance on Amazon AWS via user-data field & bitbucket.org
#!/usr/bin/env bash
set -e
NODE_ENV=production
GIT_HOSTNAME=bitbucket.org
GIT_PATH=username/project.git
GIT_PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----
...
-----END RSA PRIVATE KEY-----"
INSTALL_SCRIPT=install.sh
@moshest
moshest / appspec.yml
Last active October 13, 2021 18:09
Node.js Project on AWS CodeDeploy CentOS
version: 0.0
os: linux
files:
- source: /
destination: /home/ec2-user/node
permissions:
- object: /home/ec2-user
owner: ec2-user
group: ec2-user
type:
sudo yum install epel-release
sudo yum install nginx
#mkdir cert && cd ./cert
#openssl req -new -newkey rsa:2048 -nodes -keyout server.key -out server.csr
sudo /etc/init.d/nginx start
update-rc.d nginx defaults
#nano /etc/nginx/nginx.conf
@moshest
moshest / install.sh
Last active January 17, 2018 17:22
AWS CodeDeploy with Node.js
#!/bin/bash
# usage: `curl --silent --location https://gist.githubusercontent.com/moshest/32b19e146bc5e1665708c885e535a631/raw/install.sh | bash -`
set -e
yum -y update
AWS_REGION=`curl http://169.254.169.254/latest/dynamic/instance-identity/document|grep region|awk -F\" '{print $4}'`
echo AWS Region: $AWS_REGION
# install CodeDeploy