Skip to content

Instantly share code, notes, and snippets.

View angelix's full-sized avatar

Angelos Veglektsis angelix

  • Aveworks
  • Athens, Greece
View GitHub Profile
@angelix
angelix / command.sh
Created April 16, 2012 13:29 — forked from felixge/command.sh
Bash stuff for fighting a weak DOS attack
# Here a few bash one-liners that helped me analyze / fight a weak DOS attack against debuggable.com. Mostly for future reference.
# The attacker was opening lots of tcp connections without sending data, I believe it's called a SYN flood, see: http://tools.ietf.org/html/rfc4987#section-3.2
# Step 0: Check what is going on at port 80
$ netstat -tan | grep ':80 ' | awk '{print $6}' | sort | uniq -c
# Step 1: Increase the number of available fds
$ ulimit -n 32000
# Step 2: Restart your webserver, for me:
@angelix
angelix / ManagedDataHelper.java
Last active December 20, 2015 16:59
ManagedDataHelper is a Helper class that gives you the ability to override strings (or array of strings) saved on Android Resources (xml) with data from a remote JSON document.
public class ManagedDataHelper {
static ManagedDataHelper sSelf = null;
static final String SHARED_PREFERENCES_FILENAME = "managed_data";
Context mContext;
Resources mResources;
SharedPreferences mSharedPreferences;
private ManagedDataHelper(Context context) {
mContext = context;
mResources = mContext.getResources();
@angelix
angelix / angular-csrf-interceptor
Last active July 3, 2017 15:50
AngularJS CSRF Request Interceptor (for SailsJS)
app.factory('csrfRequestInterceptor' , function($q , $injector){
var _token = false;
return {
request : function(config){
var CSRF_URL = '/csrfToken';
if(config.url == CSRF_URL || config.method == "GET"){
return config;
}
// sailsjs hasn't time limit for csrf token, so it is safe to cache this
// remove this to request a new token

Keybase proof

I hereby claim:

  • I am angelix on github.
  • I am angelix (https://keybase.io/angelix) on keybase.
  • I have a public key ASBxcfQUJEuK6yV9LlsMWSHzoTt_dyy-IKr5IsYxxSN0HQo

To claim this, I am signing this object: