Skip to content

Instantly share code, notes, and snippets.

@naryad
naryad / local-replica-set-with-oplog.md
Created May 3, 2020 12:24 — forked from richsilv/local-replica-set-with-oplog.md
Setting up a local MongoDB replica set with oplog for use with Meteor

From an appropriate location:

mkdir replica-set
mkdir -p replica-set/rs0-0 replica-set/rs0-1
mongod --port 27018 --dbpath replica-set/rs0-0 --replSet rs0 --smallfiles --oplogSize 128 &
mongod --port 27019 --dbpath replica-set/rs0-1 --replSet rs0 --smallfiles --oplogSize 128 &
mongo localhost:27018
from selenium import webdriver
from getpass import getpass
def login_twitter(username, password):
driver = webdriver.Firefox()
driver.get("https://twitter.com/login")
username_field = driver.find_element_by_class_name("js-username-field")
password_field = driver.find_element_by_class_name("js-password-field")
### Keybase proof
I hereby claim:
* I am naryad on github.
* I am naryad (https://keybase.io/naryad) on keybase.
* I have a public key whose fingerprint is 4B4B EA57 C2F6 1ED2 DE76 074A 7A31 2DB0 4B41 8AA6
To claim this, I am signing this object:
@naryad
naryad / node_stats
Created July 9, 2015 06:35
Node stats of Elasticsearch cluster
{
"cluster_name": "name_of_cluster",
"nodes": {
"MdJhM6UfRt6pJ836HEjwCQ": {
"timestamp": 1436423508394,
"name": "Rudyard Kipling",
"transport_address": "inet[/10.92.130.29:9300]",
"host": "ip-10-92-130-29",
"ip": [
"inet[/10.92.130.29:9300]",
@naryad
naryad / es_hot_threads
Created July 9, 2015 06:26
Elasticsearch cluster hot threads output
"::: [Rudyard Kipling][MdJhM6UfRt6pJ836HEjwCQ][ip-10-92-130-29][inet[/10.92.130.29:9300]]
65.9% (329.4ms out of 500ms) cpu usage by thread 'elasticsearch[Rudyard Kipling][search][T#22]'
8/10 snapshots sharing following 14 elements
org.apache.lucene.search.ConstantScoreQuery$ConstantScorer.nextDoc(ConstantScoreQuery.java:257)
org.apache.lucene.search.Weight$DefaultBulkScorer.scoreAll(Weight.java:192)
org.apache.lucene.search.Weight$DefaultBulkScorer.score(Weight.java:163)
org.apache.lucene.search.BulkScorer.score(BulkScorer.java:35)
org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:621)
org.elasticsearch.search.internal.ContextIndexSearcher.search(ContextIndexSearcher.java:175)
##################################################################
# /etc/elasticsearch/elasticsearch.yml
#
# Base configuration for a write heavy cluster
#
# Cluster / Node Basics
cluster.name: logng
# Node can have abritrary attributes we can use for routing
@naryad
naryad / backup.sh
Created August 25, 2014 07:32 — forked from nherment/backup.sh
#!/bin/bash
# herein we backup our indexes! this script should run at like 6pm or something, after logstash
# rotates to a new ES index and theres no new data coming in to the old one. we grab metadatas,
# compress the data files, create a restore script, and push it all up to S3.
TODAY=`date +"%Y.%m.%d"`
INDEXNAME="logstash-$TODAY" # this had better match the index name in ES
INDEXDIR="/usr/local/elasticsearch/data/logstash/nodes/0/indices/"
BACKUPCMD="/usr/local/backupTools/s3cmd --config=/usr/local/backupTools/s3cfg put"
BACKUPDIR="/mnt/es-backups/"
YEARMONTH=`date +"%Y-%m"`
cd ~
sudo apt-get update
sudo apt-get install openjdk-7-jre-headless -y
### Check http://www.elasticsearch.org/download/ for latest version of ElasticSearch and replace wget link below
# NEW WAY / EASY WAY
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.1.1.deb
sudo dpkg -i elasticsearch-1.1.1.deb
{
"name": "socket.io.1.0",
"version": "1.0.0",
"description": "Socket.IO 1.0 using Primus",
"main": "socket.io.1.0.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
#!/bin/bash -e
# Neil Williams, reddit
# configuration that doesn't change much
REDDIT_REPO=git://github.com/reddit/reddit.git
I18N_REPO=git://github.com/reddit/reddit-i18n.git
APTITUDE_OPTIONS="-y" # limit bandwidth: -o Acquire::http::Dl-Limit=100"
# don't blunder on if an error occurs
set -e