Skip to content

Instantly share code, notes, and snippets.

View mente's full-sized avatar

Alex Vasilenko mente

View GitHub Profile
@mente
mente / gist:3205999
Created July 30, 2012 10:12
graylog analytics exception
Started POST "/analytics/shell" for 192.168.1.101 at Mon Jul 30 06:10:37 -0400 2012
Processing by AnalyticsController#shell as */*
Parameters: {"cmd"=>"stream('50155c10bb705c5375000007').count()"}
Error while computing shell command: illegal ObjectId format/usr/lib64/ruby/gems/1.8/gems/bson-1.3.1/lib/../lib/bson/types/object_id.rb:129:in `from_string'
/usr/lib64/ruby/gems/1.8/gems/bson-1.3.1/lib/../lib/bson/types/object_id.rb:26:in `ObjectId'
/opt/graylog2-web-interface/app/models/stream.rb:39:in `find_by_id'
/opt/graylog2-web-interface/app/models/shell.rb:84:in `parse_stream_narrows'
/opt/graylog2-web-interface/app/models/shell.rb:78:in `each'
/opt/graylog2-web-interface/app/models/shell.rb:78:in `parse_stream_narrows'
/opt/graylog2-web-interface/app/models/shell.rb:57:in `parse'
Name: logstash
Version: 1.1.12
Release: 1%{?dist}
Summary: logstash is a tool for managing events and logs
Group: System/Logging
License: ASL 2.0
URL: http://logstash.net/
Source0: http://semicomplete.com/files/logstash/logstash-%{version}-monolithic.jar
Source1: logstash
@mente
mente / composerw
Last active December 20, 2015 10:39
Composer wrapper script that checks whether composer is installed in the system. If not - install it to bin folder of this script. Idea is taken from gradle and gradlew that I've been struggling with during this weekend.
#!/bin/bash
# Composer wrapper script that checks whether composer is installed in the system. If not - install it to bin folder of this script
# Idea is taken from gradle and gradlew that I've been struggling with during this weekend
# author - Alex Vasilenko http://github.com/mente
# Exit on any failure
set -e
#http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in
BASEDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
android {
defaultConfig {
versionName "actionbar"
}
signingConfigs {
release {
storeFile file("android.keystore")
...
}
}
android {
defaultConfig {
versionName "actionbar"
}
signingConfigs {
release {
storeFile file("android.keystore")
...
}
}
@mente
mente / build.gradle
Created November 14, 2013 10:27
Example of using support v4 library with android gradle plugin
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:+'
}
}
@mente
mente / check-dex-methods.sh
Last active August 29, 2015 13:59
calculate total number of methods in dex files
#!/usr/bin/env sh
dxPath="/Applications/Android Studio.app/sdk/build-tools/android-4.4/dx"
jarDir=build/pre-dexed/debug
rm temp.dex
sum=0
line='-----------------------------------------------------------------------------------------------------------------------'
for file in $jarDir/*.jar; do
"$dxPath" --dex --output=temp.dex $file
@mente
mente / gist:08db44fc28f1d94ed44c
Created October 8, 2014 08:01
Failed Octave compilation on Mavericks 10.9.5
This file has been truncated, but you can view the full file.
Warning: No Fortran optimization information was provided. You may want to consider
setting FCFLAGS and FFLAGS or pass the `--default-fortran-flags` option to
`brew install` if your compiler is compatible with GCC.
If you like the default optimization level of your compiler, ignore this
warning.
Warning: No Fortran optimization information was provided. You may want to consider
setting FCFLAGS and FFLAGS or pass the `--default-fortran-flags` option to
`brew install` if your compiler is compatible with GCC.
@mente
mente / require-config.js
Created October 13, 2014 08:04
PhpStorm 8.0.1 require.js error
require.config({
waitSeconds: 15,
baseUrl: '/js',
paths: {
templates: '../templates',
knockout: 'libs/knockout',
'jquery.ui.widget': 'libs/ui/widget',
'jquery.ui.sortable': 'libs/ui/sortable',
core: 'libs/ui/core',
mouse: 'libs/ui/mouse',
#Table
CREATE TABLE `departments` (
`in` int(11) unsigned NOT NULL,
`out` int(11) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
#Via JOIN
SELECT i.count + o.count as total, i.in
FROM
(