Skip to content

Instantly share code, notes, and snippets.

@radmen
radmen / gist:2300725
Created April 4, 2012 12:13 — forked from smgoller/gist:1171102
git svn workflow
# adapted from http://notes.jimlindley.com/2008/3/25/git-svn-that-works-for-me
# initial setup
git svn init <svn_repo>
git svn fetch -r HEAD
# alternate way - when there's need to use branches etc
git svn clone --trunk=devel --branches=branches -r NUM <svn_repo> # NUM is one of the latest revisions
git svn fetch
# alternate way - END
@radmen
radmen / shot.js
Created May 23, 2012 21:21
PhantomJS Shotr - simple script to make webpage shot
var page = require('webpage').create(),
system = require('system'),
fs = require('fs'),
uri = document.createElement('a'), // from this https://gist.github.com/2428561
viewport,
hash = function(string) {
var hash = 0,
char;
if (string.length == 0) return hash;
@radmen
radmen / gist:2842945
Created May 31, 2012 11:58
Recursive Closure
<?php
// this is needed
$foo = null;
$foo = function($no = 1) use (& $foo) {
echo "Foo: {$no}\n";
if($no < 10) {
$foo($no + 1);
}
@radmen
radmen / gist:2948170
Created June 18, 2012 12:33
MooTools injecter scriptlet
javascript:var%20script%20=%20document.createElement('script');script.src%20=%20'https://ajax.googleapis.com/ajax/libs/mootools/1.4.5/mootools-yui-compressed.js';script.type='text/javascript';document.getElementsByTagName('head')[0].appendChild(script);void(0);
@radmen
radmen / gist:3122706
Created July 16, 2012 13:24
Js Sleep sort
// ported from http://dis.4chan.org/read/prog/1295544154
var numbers = [10, 3, 2, 6, 1, 5],
sleep_sort = function() {
var i = numbers.shift();
if(!numbers.length) {
return;
}
@radmen
radmen / gitlab.sh
Created August 8, 2012 09:52
Gitlab init.d script (without using nginx and unicorn)
#! /bin/bash
### BEGIN INIT INFO
# Provides: gitlab
# Required-Start: $local_fs $remote_fs $network $syslog redis-server
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: GitLab git repository management
# Description: GitLab git repository management
### END INIT INFO
@radmen
radmen / README.md
Created September 10, 2012 08:15
Apache vhost config for gitlab

unicorn config file

Edit file /home/gitlab/gitlab/config/unicorn.rb

Find line listen "#{app_dir}/tmp/sockets/gitlab.socket" and comment it. Uncomment line listen "127.0.0.1:8080"

required modules for apache

  • sudo a2enmod proxy
  • sudo a2enmod proxy_balancer
@radmen
radmen / stylebot.json
Created October 4, 2012 20:16
Stylebot config
{"www.youtube.com":{"_enabled":true,"_rules":{"div.comments-section":{"display":"none"}}},"www.trojmiasto.pl":{"_enabled":true,"_rules":{"div.opinions-wrap.opinions-tree":{"display":"none"}}},"wyborcza.pl":{"_enabled":true,"_rules":{"#article_toolbar":{"display":"none"}}},"*":{"_enabled":true,"_rules":{}},"gazeta.pl":{"_enabled":true,"_rules":{"#article_toolbar":{"display":"none"}}}}
@radmen
radmen / .htaccess
Created January 2, 2013 21:56
Wordpress lazy static site generator
RewriteEngine On
RewriteBase /
RewriteCond %{DOCUMENT_ROOT}/static/%{REQUEST_URI} -f
RewriteRule ^(.*)$ /static/$1 [L,QSA]
RewriteCond %{DOCUMENT_ROOT}/static/%{REQUEST_URI}/index.html -f
RewriteRule ^(.*)$ /static/$1/index.html [L,QSA]
RewriteRule ^index\.php$ - [L]
@radmen
radmen / qitlab-quickfix.md
Last active December 13, 2015 19:09
Quickfix for Gitlab 500 error on creating user.

On some special situations (probably bad server config) Gitlab instead of queuing email throws 500 error.
To fix it You can force Gitlab to send emails immediately.

Just run this script inside gitlab installation folder (normally it's /home/gitlab/gitlab):

grep -r "Notify.delay" app/* | cut -d":" -f1 | xargs sed -i.bak -e"s/Notify\.delay\.\(.*\)/Notify.\1.deliver/"