Skip to content

Instantly share code, notes, and snippets.

View soulmachine's full-sized avatar

Frank Dai soulmachine

View GitHub Profile
@devilelephant
devilelephant / AWS4Signer.groovy
Last active October 21, 2019 08:24
Java/Groovy example of using Amazon AWS AWS4Signer class to sign requests (in our case elasticsearch calls)
package com.clario.aws
import com.amazonaws.DefaultRequest
import com.amazonaws.SignableRequest
import com.amazonaws.auth.AWS4Signer
import com.amazonaws.auth.AWSCredentialsProvider
import com.amazonaws.http.HttpMethodName
import groovy.util.logging.Slf4j
import org.apache.http.client.utils.URLEncodedUtils
import org.springframework.http.HttpHeaders
@mbijon
mbijon / disable-xss-auditor.sh
Created September 19, 2016 19:04
CLI command to start Chrome with XSS Auditor disabled. Use for XSS/security testing
'/Applications/Google Chrome.app/Contents/MacOS/Google Chrome' --disable-xss-auditor --enable-devtools-experiments --disable-features=enable-automatic-password-saving
@deepika087
deepika087 / GenericMultiListIterator.java
Last active June 11, 2018 15:29
Iterates through (generic) List of List <<a1,a2>, <b1,b2,b3,b4>, <c1,c2,c3,c4,c5,c6,c7>> Generates output a1, b1, c1, a2, b2, c2, b3, c3, b4, c4,c5,c6,c7
package com.expedia.sample;
import java.util.ArrayList;
import java.util.Iterator;
public class MultiListIterator<E> implements Iterator<E> {
private ArrayList<ArrayList<E>> useThisList;
private int numOfList;
private int[] sizeOfEachList;
@amgorb
amgorb / redis-client-ouput-buffer-limit
Created February 20, 2017 16:19
redis replication scheduled to be closed ASAP for overcoming of output buffer limits.
If you redis initial replication fails with error like
"5101:M 20 Feb 18:14:29.130 # Client id=4500196 addr=71.459.815.760:43872 fd=533 name= age=127 idle=127 flags=S db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=0 obl=13997 oll=1227 omem=192281275 events=rw cmd=psync scheduled to be closed ASAP for overcoming of output buffer limits.
means that slave buffer is not enough and you should increase it (at master!) with command like
redis-cli config set client-output-buffer-limit "slave 836870912 836870912 0"
more info: https://redis.io/topics/clients
@mikebridge
mikebridge / ExampleComponent.tsx
Created March 22, 2017 15:43
Typescript component using react-intl
import * as React from "react";
import SelectField from "material-ui/SelectField";
import { intlShape, injectIntl, FormattedMessage, InjectedIntlProps } from "react-intl";
interface IExampleProps {
// ...
}
class ExampleComponentWrapped extends React.Component<IExampleProps & InjectedIntlProps, {}> {