Skip to content

Instantly share code, notes, and snippets.

@nicolashery
nicolashery / elasticsearch.md
Last active December 30, 2023 19:03
Elasticsearch: updating the mappings and settings of an existing index

Elasticsearch: updating the mappings and settings of an existing index

Note: This was written using elasticsearch 0.9.

Elasticsearch will automatically create an index (with basic settings and mappings) for you if you post a first document:

$ curl -X POST 'http://localhost:9200/thegame/weapons/1' -d \
'{
  "_id": 1,
@goodmami
goodmami / logging.bash
Last active May 6, 2024 18:24
Basic logging commands for Linux shell scripts
#!/bin/bash
##
## Simple logging mechanism for Bash
##
## Author: Michael Wayne Goodman <[email protected]>
## Thanks: Jul for the idea to add a datestring. See:
## http://www.goodmami.org/2011/07/simple-logging-in-bash-scripts/#comment-5854
## Thanks: @gffhcks for noting that inf() and debug() should be swapped,
## and that critical() used $2 instead of $1
@jrolstad
jrolstad / gist:5ca7d78dbfe182d7c1be
Last active December 16, 2023 06:55
List all NodaTime Timezones
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NodaTime.TimeZones;
using NUnit.Framework;
namespace what_time_is_it
{
@holly
holly / check_drbd.sh
Created June 28, 2015 13:27
keepalived+drbd sample
#!/bin/bash
EXIT_CODE=0
STATUS_FILE=/tmp/drbd.status
STATUS=$(sed -e 's/.* state:\(.*\)$/\1/' $STATUS_FILE)
if [ "${STATUS}" != "MASTER" ]; then
echo "current status is ${STATUS}. skip"
exit
@maxrabin
maxrabin / CountLinesAndLetters.js
Created March 13, 2016 12:09
Example Lambda Function to process lines of text files when uploaded to S3
'use strict';
var AWS = require('aws-sdk');
var S3 = new AWS.S3();
var readline = require('readline');
exports.handler = function (event, context) {
//Get S3 file bucket and name
//Make sure to loop through event.Records, don't assume there is only 1 in production!!!
var bucket = event.Records[0].s3.bucket.name;
var key = event.Records[0].s3.object.key;
@andreicristianpetcu
andreicristianpetcu / ansible-summary.md
Created May 30, 2016 19:25
This is an ANSIBLE Cheat Sheet from Jon Warbrick

An Ansible summary

Jon Warbrick, July 2014, V3.2 (for Ansible 1.7)

Configuration file

intro_configuration.html

First one found from of

@hendi
hendi / rocket-sqlx.rs
Last active September 7, 2024 20:02
Rust: rocket with sqlx
#[macro_use] extern crate rocket;
use std::env;
use anyhow::Result;
use rocket::State;
use rocket::http::Status;
use sqlx::{Pool, Postgres};