Skip to content

Instantly share code, notes, and snippets.

View RushOnline's full-sized avatar

Eugene RushOnline

  • Intech
  • Great Novgorod, Russia
View GitHub Profile
--- rp-pppoe-3.8/src/pppoe-server.c 2010-07-15 16:42:39.031057949 +0400
+++ rp-pppoe-3.8/src/pppoe-server.c 2010-07-15 16:48:14.078605821 +0400
@@ -97,6 +97,7 @@
#define MAX_SERVICE_NAMES 64
static int NumServiceNames = 0;
static char const *ServiceNames[MAX_SERVICE_NAMES];
+static int ReactionOnNoServiceName = 1;
PppoeSessionFunctionTable DefaultSessionFunctionTable = {
PppoeStopSession,
@RushOnline
RushOnline / gist:5387778
Created April 15, 2013 12:43
Replace DryCrudSample with HotspotManager in all files within current directory recursively.
grep -Rl DryCrudSample . | xargs -n1 sed -i 's/DryCrudSample/HotspotManager/g'
@RushOnline
RushOnline / boot.rb
Created April 22, 2013 13:54
Change default host:port bindings for rails app. Add the following lines to the file config/boot.rb
# add following to file config/boot.rb to change default host:port bindings
require 'rails/commands/server'
module Rails
class Server
alias :default_options_alias :default_options
def default_options
default_options_alias.merge!(Host: '127.0.0.1', Port: 3333)
end
@RushOnline
RushOnline / myapp-rails.conf
Created April 28, 2013 14:24
Run rails application under upstart control
description "MyApp @ Rails"
start on runlevel [2345]
stop on runlevel [!2345]
env APP_PATH="/var/www/apps/ecilop"
env APP_USER="deploy"
env APP_EXEC="rails server -e production"
# env APP_EXEC="rackup myapp.ru -s thin -E production"
@RushOnline
RushOnline / expect_binary.js
Created May 2, 2013 23:00
To get right binary response we must use overrideMimeType method of XHR in beforeSend filter method of jQuery ajax call.
$.ajax({
type: "POST",
url: href,
beforeSend: function (xhr) {
xhr.overrideMimeType("text/plain; charset=x-user-defined");
},
success: function(response) {
var binary = Array.prototype.map.call(response, function(c) { return c.charCodeAt(0) & 0xFF; });
console.debug('ajax done: ', binary);
},
@RushOnline
RushOnline / get-installed-gnome-extensions.js
Created May 23, 2013 17:04
Take a list of installed gnome-shell extensions. Point your chromium broser to https://extensions.gnome.org/local/ , press Ctr+Shift+I to pop up developer tools, and enter following code.
$('.title-link').each(function() { console.log($(this).text()) })
@RushOnline
RushOnline / no-max-title.diff
Created September 26, 2014 06:14
Remove title bar on maximized windows (Gnome 3.10 Ambiance Theme)
diff --git a/metacity-1/metacity-theme-1.xml b/metacity-1/metacity-theme-1.xml
index 7aaeb54..e35b804 100644
--- a/metacity-1/metacity-theme-1.xml
+++ b/metacity-1/metacity-theme-1.xml
@@ -23,18 +23,19 @@
<border name="button_border" left="0" right="0" top="1" bottom="0"/>
</frame_geometry>
-<frame_geometry name="geometry_maximized" rounded_top_left="false" rounded_top_right="false" rounded_bottom_left="false" rounded_bottom_right="false">
+<frame_geometry name="geometry_maximized" rounded_top_left="false" rounded_top_right="false" rounded_bottom_left="false" rounded_bottom_right="false" has_title="false">
@RushOnline
RushOnline / pin_macros.h
Created October 6, 2014 22:17
port bits access macros for AVR uC family (avr-gcc compiler) from scmRTOS
/*----------------------------------------------------------------------------------------------
* pin_macros.h (AVR/avr-gcc)
*----------------------------------------------------------------------------------------------
*
* Author: Oleksandr Redchuk aka ReAl (real@real.kiev.ua)
*
* Description: port bits access macros for AVR uC family (avr-gcc compiler)
*
* Based on macros by Ascold Volkov, Andy Mozzevilov, Aleksey Musin
*----------------------------------------------------------------------------------------------
@RushOnline
RushOnline / variant.cpp
Created March 18, 2015 19:37
C++ variant template
#include <memory>
#include <string>
class variant
{
public:
template <class T>
variant& operator = (T const& t)
{
@RushOnline
RushOnline / showargs.sh
Created May 9, 2015 20:11
Show how are command line arguments (options) passed to program (function main())
#!/bin/bash
cat /proc/$$/cmdline | xargs -0 -n1 echo