Skip to content

Instantly share code, notes, and snippets.

Avatar

Petr Kudinov PitBeast

  • XIAG
  • Novosibirsk, Russia
View GitHub Profile
View gist:9303af1e8f25e3b2ee9d96c9df29fd25
curl -H "Content-Type:application/json" -X POST http://localhost:5984/$DB/_view_cleanup
curl -H "Content-Type:application/json" -X POST https://localhost:5984/$DB/_compact
curl -H "Content-Type:application/json" -X POST https://localhost:5984/$DB/_compact
View myProxy.pac
function FindProxyForURL(url, host) {
return "SOCKS 192.168.1.4:1080";
}
@PitBeast
PitBeast / brctl_show.sh
Created May 13, 2020
brforward convertion
View brctl_show.sh
brctl_showmacs () {
cat /sys/class/net/$1/brforward > /tmp/brforward ;
printf "port no\tmac addr\t\tis local?\tageing timer\n" ;
hexdump -v -e '5/1 "%02x:" /1 "%02x" /1 " %x" /1 " %x" 1/4 " %i" 1/4 "\n"' /tmp/brforward | awk '{ islocal = $3 ? "yes" : "no" ; printf "%3i\t%s\t%s\t\t%8.2f\n",$2,$1,islocal,$4/100 } ' ;
}
@PitBeast
PitBeast / gitlab-runner
Last active Mar 16, 2017
OpenSuse 12.1 gitlab-runner init script
View gitlab-runner
#!/bin/sh
# For RedHat and cousins:
# chkconfig: - 99 01
# description: GitLab Runner
# processname: /usr/local/bin/gitlab-ci-multi-runner
### BEGIN INIT INFO
# Provides: /usr/local/bin/gitlab-ci-multi-runner
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
View fastDate.js
function fastDateFactory() {
var DAYS_IN_YEAR = 365;
var DAYS_IN_LEAP_YEAR = 366;
var DAYS_IN_4_YEARS = DAYS_IN_LEAP_YEAR + DAYS_IN_YEAR * 3;
var DAYS_IN_OTHER_FIRST_4_YEARS = DAYS_IN_YEAR * 4;
var DAYS_IN_FIRST_100_YEARS = DAYS_IN_4_YEARS * 25;
var DAYS_IN_NEXT_100_YEARS = DAYS_IN_OTHER_FIRST_4_YEARS + DAYS_IN_4_YEARS * 24;
var DAYS_IN_400_YEARS = DAYS_IN_FIRST_100_YEARS + DAYS_IN_NEXT_100_YEARS * 3;
@PitBeast
PitBeast / portal.js
Last active Aug 29, 2015
Directives for show part of some template in other template
View portal.js
'use strict';
angular
.module('portal', [''])
.directive('portalIn', [function() {
return {
scope: {
key: '@',
portalContainer: '='
},
View gist:c3df13c26f5cfd04bafd
//тесты для текущего(твоего) варианта директивы
describe('statsHeight', function() {
var $compile,
$rootScope,
$timeout;
beforeEach(function () {
angular.mock.module('gby.common');
});