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
| def ip2hex(cidr, router): | |
| addr, mask = cidr.split("/") | |
| mask = int(mask) | |
| addr = [("%2s" % hex(int(i))[2:]).replace(" ", "0") for i in addr.split(".") if i != "0"] | |
| parts = mask/8 - len(addr) | |
| if mask%8 > 0: | |
| parts += 1 | |
| if parts > 0: | |
| for i in range(int(parts)): | |
| addr.append("00") |
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
| -- show running queries (pre 9.2) | |
| SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
| FROM pg_stat_activity | |
| WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
| ORDER BY query_start desc; | |
| -- show running queries (9.2) | |
| SELECT pid, age(clock_timestamp(), query_start), usename, query | |
| FROM pg_stat_activity | |
| WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
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
| Started by user rtyler | |
| Loading library pipeline-library@acme-test | |
| > git rev-parse --is-inside-work-tree # timeout=10 | |
| Fetching changes from the remote Git repository | |
| > git config remote.origin.url git://github.com/jenkins-infra/pipeline-library.git # timeout=10 | |
| Fetching upstream changes from git://github.com/jenkins-infra/pipeline-library.git | |
| > git --version # timeout=10 | |
| > git fetch --tags --progress git://github.com/jenkins-infra/pipeline-library.git +refs/heads/*:refs/remotes/origin/* | |
| > git rev-parse refs/remotes/origin/acme-test^{commit} # timeout=10 | |
| > git rev-parse refs/remotes/origin/origin/acme-test^{commit} # timeout=10 |
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 bash | |
| # Time-stamp: <2017-04-27 09:57:21 kmodi> | |
| # Time-stamp: <2018-03-20 12:58:02 bobpaul> | |
| # derived from kmodi's gist: https://gist.github.com/kaushalmodi/74e9875d5ab0a2bc1010447f1bee5d0a | |
| # | |
| # Example of using getopt to parse command line options | |
| # http://stackoverflow.com/a/29754866/1219634 Limitation: All the options | |
| # starting with - have to be listed in --options/--longoptions, else getopt will | |
| # error out. | |
| # The downside is that if you intend to use this as a wrapper to some other program, |
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
| #!groovy | |
| def handleCheckout = { | |
| if (env.gitlabMergeRequestId) { | |
| sh "echo 'Merge request detected. Merging...'" | |
| def credentialsId = scm.userRemoteConfigs[0].credentialsId | |
| checkout ([ | |
| $class: 'GitSCM', | |
| branches: [[name: "${env.gitlabSourceNamespace}/${env.gitlabSourceBranch}"]], | |
| extensions: [ |
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 python3 | |
| # CSR OTAU binary parser | |
| # https://developer.qualcomm.com/qfile/34081/csr102x_otau_overview.pdf | |
| # For use with test and demonstration only. This is obviously not official and | |
| # is not affiliated with Qualcomm. | |
| import io | |
| import os | |
| import sys |
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
| # Client Bridged / Client Mode / RelayD and IGMPProxy (It works) | |
| # RelayD is to redirect packages and IGMP is for redirect IGMP packages | |
| # Our network is 192.168.1.0/24 | |
| # Steps: | |
| # Configure WAN as static | |
| # We should edit our wan iface and put static IP | |
| uci set network.wan='interface' | |
| uci set network.wan.proto='static' | |
| uci set network.wan.ipaddr='192.168.1.239' # Main Network IP |
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
| DROP FUNCTION IF EXISTS MurmurHashV3; | |
| DELIMITER // | |
| CREATE FUNCTION `MurmurHashV3`(`keyx` varchar(65535), `seed` int unsigned) | |
| RETURNS int unsigned | |
| BEGIN | |
| DECLARE remainder,bytes,c1,c2,i, m1,m2 INT unsigned; | |
| DECLARE h1,k1,h1b BIGINT unsigned; | |
| SET remainder = LENGTH(keyx) & 3; | |
| SET bytes = LENGTH(keyx) - remainder; | |
| SET h1 = seed; |
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
| DROP FUNCTION IF EXISTS MurmurHashV2; | |
| DELIMITER // | |
| CREATE FUNCTION `MurmurHashV2`(`keyx` varchar(65535), `seed` int unsigned) | |
| RETURNS int unsigned | |
| BEGIN | |
| DECLARE l,i,m,r INT unsigned; | |
| DECLARE h,k BIGINT unsigned; | |
| SET l = LENGTH(keyx), i=1, m = 0x5bd1e995, r=24; | |
| SET h = seed ^ l; | |
NewerOlder