This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
// interval -- min interval between callback, in ms | |
// fn_callback -- callback function | |
// max_queue_len -- drop callback when exceed max queue length | |
function ratelimit(interval, fn_callback) { | |
var last = 0, | |
max_queue_len = 100, | |
schedule_later = function(context, args, timeout) { | |
setTimeout(function() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# coding: utf-8 | |
import gflags | |
import logging | |
import os | |
import sys | |
from pygaga.helpers.logger import log_init | |
from pygaga.helpers.utils import make_dirs_for_file |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
port=$3 | |
if [ $port'z' == 'z' ] | |
then | |
port=3306 | |
fi | |
mysql -h${1} -P${port} -e "select * from information_sechema.processlist where info is not null and time>${2} and user like '%dbreader%' and info like '%select%'\G">.sql.${1}.tmp | |
pids=`mysql -h${1} -P${port} -e "select id from information_sechema.processlist where info is not null and time>${2} and user like '%dbreader%' and info like '%select%'"|awk -F\| '{print $1"\n"}'` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv,sys | |
def fn_sort_by(key, header_index): | |
return lambda x,y:cmp(x[header_index[key]], y[header_index[key]]) | |
if __name__ == "__main__": | |
csvfilename = sys.argv[1] | |
sort_fileds = sys.argv[2] | |
f = open(csvfilename) | |
header = f.readline().split(',') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- return false unless user.valid_password?(password) | |
+ if not user.valid_password?(password) | |
+ # Second chance - try LDAP authentication | |
+ return false unless Gitlab.config.ldap.enabled | |
+ ldap_auth(login,password) | |
+ return false unless !user.nil? | |
+ end | |
+ #return false unless user.valid_password?(password) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
delimiter # | |
create trigger fix_dot_account_external_ids after insert on account_external_ids | |
for each row | |
begin | |
SET @external_id = NEW.external_id; | |
if @external_id like 'gerrit:*' then | |
SET @new_external_id = REPLACE(@external_id, 'gerrit:', 'username:'); | |
insert into account_external_ids (account_id, email_address, password, external_id) values (new.account_id, new.email_address, new.password, @new_external_id); | |
end if; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import simplejson | |
import subprocess | |
USERNAME='user' | |
PROJECT='prj' | |
HOST='192.168.0.1' | |
ls_cmd = "ssh -p 29418 %s@%s gerrit query limit:1000 --current-patch-set --format=json status:open project:%s" % (USERNAME, HOST, PROJECT) | |
submit_cmd = "ssh -p 29418 %s@%s gerrit review --code-review 2 --abandon %s" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import os | |
import sys | |
import shutil | |
import json | |
import getopt | |
import urllib2 | |
from urllib import urlencode |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"metadata": { | |
"name": "Python String Tutorials" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"metadata": { | |
"name": "Python Tutorials 2" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ | |
{ |