Skip to content

Instantly share code, notes, and snippets.

View jamalahmedmaaz's full-sized avatar
💭
Practice, Preparation, Endless Repetition - Kung Fu

ahmed jamal maaz jamalahmedmaaz

💭
Practice, Preparation, Endless Repetition - Kung Fu
View GitHub Profile
@ryanbrainard
ryanbrainard / gist:9765354
Last active August 29, 2015 13:57
Example of using `_HttpMethod=PATCH` query param with clients that do not support `PATCH`.
> POST /services/data/v29.0/sobjects/Component__c/a1IV0000000MN90MAG?_HttpMethod=PATCH HTTP/1.1
> User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8y zlib/1.2.5
> Host: cs12.salesforce.com
> Accept: */*
> X-PrettyPrint: 1
> Authorization: Bearer REDACTED
> Content-Type: application/json
> Content-Length: 20
>
* upload completely sent off: 20 out of 20 bytes
##################### ElasticSearch Configuration Example #####################
# This file contains an overview of various configuration settings,
# targeted at operations staff. Application developers should
# consult the guide at <http://elasticsearch.org/guide>.
#
# The installation procedure is covered at
# <http://elasticsearch.org/guide/en/elasticsearch/reference/current/setup.html>.
#
# ElasticSearch comes with reasonable defaults for most settings,
@Xorlev
Xorlev / MutationUtils.java
Created December 11, 2013 05:20
Utils useful for making ColumnFamilyOutputFormat work with CQL3 tables (CQL3 is all composite types)
package com.fullcontact.hadoop.cassandra;
import com.google.common.collect.Lists;
import org.apache.cassandra.db.marshal.AbstractType;
import org.apache.cassandra.db.marshal.CompositeType;
import org.apache.cassandra.db.marshal.UTF8Type;
import org.apache.cassandra.thrift.Column;
import org.apache.cassandra.thrift.ColumnOrSuperColumn;
import org.apache.cassandra.thrift.Mutation;
import org.apache.cassandra.utils.ByteBufferUtil;
@visenger
visenger / install_scala_sbt.sh
Last active January 31, 2023 19:10
Scala and sbt installation on ubuntu 12.04
#!/bin/sh
# one way (older scala version will be installed)
# sudo apt-get install scala
#2nd way
sudo apt-get remove scala-library scala
wget http://www.scala-lang.org/files/archive/scala-2.11.4.deb
sudo dpkg -i scala-2.11.4.deb
sudo apt-get update
@kritik
kritik / gist:5196475
Created March 19, 2013 14:19
god config
# == God config file
# http://god.rubyforge.org/
# Author: Gump
#
# fixed thin ports <michael@glauche.de>
#
# Config file for god that configures watches for each instance of a thin server for
# each thin configuration file found in /etc/thin.
require 'yaml'
@lukas-vlcek
lukas-vlcek / gist:5143799
Last active February 7, 2023 21:50
Adding a new analyzer into existing index in Elasticsearch (requires close/open the index). Tested with Elasticsearch 0.19.12.
// create an index with an analyzer "myindex"
curl -X PUT localhost:9200/myindex -d '
{
"settings" : {`
"index":{
"number_of_replicas":0,
"number_of_shards":1,
"analysis":{
"analyzer":{
"first":{
@kennydude
kennydude / Java.java
Created July 14, 2012 14:31
Encrypt from Java and decrypt on Node.js
// Encrypt where jo is input, and query is output and ENCRPYTION_KEy is key
byte[] input = jo.toString().getBytes("utf-8");
MessageDigest md = MessageDigest.getInstance("MD5");
byte[] thedigest = md.digest(ENCRYPTION_KEY.getBytes("UTF-8"));
SecretKeySpec skc = new SecretKeySpec(thedigest, "AES/ECB/PKCS5Padding");
Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
cipher.init(Cipher.ENCRYPT_MODE, skc);
byte[] cipherText = new byte[cipher.getOutputSize(input.length)];
@dideler
dideler / bootstrapping.md
Last active April 8, 2024 04:15
Bootstrapping - a list of useful resources to get up and running quickly

Welcome!

UPDATE: This list is no longer maintained. I've moved it to its own repo so you can send suggestions as Pull Requests. https://github.com/dideler/bootstrapping/

For feedback or suggestions, please send a tweet (@dideler). Gist comments don't notify me. Pull requests aren't possible with gists (yet), so I don't recommend forking because then I can't easily get the change.

Starring this gist will give me an idea of how many people consider this list useful.

@AndreasBriese
AndreasBriese / underscoreAddon.js
Created January 24, 2012 14:45
underscore addon -> sum, mean, median, nrange
// underscore addon with sum, mean, median and nrange function
// see details below
_.mixin({
// Return sum of the elements
sum : function(obj, iterator, context) {
if (!iterator && _.isEmpty(obj)) return 0;
var result = 0;
if (!iterator && _.isArray(obj)){