Skip to content

Instantly share code, notes, and snippets.

View nnhansg's full-sized avatar
🏠
Working from home

Nathan nnhansg

🏠
Working from home
View GitHub Profile
@nnhansg
nnhansg / install_node_10.js
Created September 23, 2022 14:50 — forked from makevoid/install_node_10.js
Install node 10
# bash <(curl -s https://gist.githubusercontent.com/makevoid/0ace4d915b37a3e57a7aead6397525c9/raw/1fe13cbb52a3068f8d9b4e05f8fd306d1d2714ce/install_latest_node.js)
set -xe
sudo apt-get update -y
sudo apt-get install -y curl apt-transport-https ca-certificates
curl --fail -ssL -o setup-nodejs https://deb.nodesource.com/setup_10.x
@nnhansg
nnhansg / gist:3e4af69915751700d9cc5bdea158d0ba
Created March 27, 2021 17:05 — forked from luckydev/gist:b2a6ebe793aeacf50ff15331fb3b519d
Increate max no of open files limit in Ubuntu 16.04/18.04 for Nginx
# maximum capability of system
user@ubuntu:~$ cat /proc/sys/fs/file-max
708444
# available limit
user@ubuntu:~$ ulimit -n
1024
# To increase the available limit to say 200000
user@ubuntu:~$ sudo vim /etc/sysctl.conf
@nnhansg
nnhansg / .htaccess
Created March 9, 2021 02:08 — forked from joostvanveen/.htaccess
.htaccess Security
######################################################################
## Word to the wise ##
## It is best to keep your htaccess files as clean as possible ##
## and set as many specs in your Apache config as you can. ##
## Htaccess slows down Apache. ##
## Review the entire file before use, especially the TODO sections. ##
######################################################################
Options -MultiViews
Options +FollowSymLinks
@nnhansg
nnhansg / gist:7e035326afed63e7c87de3d2757923fb
Created March 5, 2021 07:17 — forked from pitch-gist/gist:2999707
HTML: Simple Maintenance Page
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>
@nnhansg
nnhansg / elasticsearch-result-window-is-too-large-from-size.md
Created December 1, 2020 09:15 — forked from ntamvl/elasticsearch-result-window-is-too-large-from-size.md
ElasticSearch - Result window is too large, from + size must be less than or equal to: [10000]

Result window is too large, from + size must be less than or equal to: [10000] but was [1000000]. See the scroll api for a more efficient way to request large data sets. This limit can be set by changing the [index.max_result_window] index level parameter

I suppose the proper fix would be to modify the code to use the scroll API, but for a quick fix, you can use the following:

curl -XPUT http://localhost:9200/doraana/_settings -d '{ "index" : { "max_result_window" : 1000000 } }'

Use kibana

With Elastic server: http://localhost:9200/doraana, with index: doraana

@nnhansg
nnhansg / 1. ELK.install
Created November 6, 2020 10:48 — forked from PavloBezpalov/1. ELK.install
ELK Stack with Rails (Elasticsearch, Logstash, Kibana) on Ubuntu VPS
INSTALL JAVA
$ sudo apt-get update && sudo apt-get install default-jre
INSTALL ELASTIC SEARCH https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-repositories.html
$ wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
$ echo "deb https://packages.elastic.co/elasticsearch/2.x/debian stable main" | sudo tee -a /etc/apt/sources.list.d/elasticsearch-2.x.list
$ sudo apt-get update && sudo apt-get install elasticsearch
$ sudo update-rc.d elasticsearch defaults 95 10
$ sudo service elasticsearch restart
$ sudo service elasticsearch status
@nnhansg
nnhansg / libreadline_6_not_found.sh
Created July 1, 2020 01:57 — forked from wbotelhos/libreadline_6_not_found.sh
Library not loaded: /usr/local/opt/readline/lib/libreadline.6.dylib (LoadError)
ln -s /usr/local/opt/readline/lib/libreadline.7.0.dylib /usr/local/opt/readline/lib/libreadline.6.dylib
@nnhansg
nnhansg / gist:0fd0b443c0eaa327fe926d754fd6be98
Created June 11, 2020 22:18 — forked from siruguri/gist:66926b42a0c70ef7119e
Removing and setting constants in Ruby
# I am doing this because the server admin forgot to
# Renew their certificate!
prev_setting = OpenSSL::SSL.send(:remove_const, :VERIFY_PEER)
OpenSSL::SSL.const_set(:VERIFY_PEER, OpenSSL::SSL::VERIFY_NONE)
# do my connnection thang!
OpenSSL::SSL.send(:remove_const, :VERIFY_PEER)
OpenSSL::SSL.const_set(:VERIFY_PEER, prev_setting)
@nnhansg
nnhansg / gist:3e038f439efba86a9270ef4efb4da143
Created June 5, 2020 07:26 — forked from georgkreimer/gist:537794
pretty print json in ruby
require 'json'
my_json = { :array => [1, 2, 3, { :sample => "hash"} ], :foo => "bar" }
puts JSON.pretty_generate(my_json)
Which gets you...
{
"array": [
1,
2,
3,