A super simple bash script to check the status of a GitLab CI pipeline.
$ git push
...
$ git pipeline-status
Status of last pipeline for user/project on gitlab/master:
"pending"
...
$ git pipeline-status
A super simple bash script to check the status of a GitLab CI pipeline.
$ git push
...
$ git pipeline-status
Status of last pipeline for user/project on gitlab/master:
"pending"
...
$ git pipeline-status
#!/bin/bash | |
# This script dumps a database to SQL, compresses, encrypts and timestamps it, then saves it to Dropbox. Ideal for a cronjob. | |
# It uses symmetric encryption, so guard your password carefully. | |
# | |
# NOT RECOMMENDED FOR LARGE DATABASES! | |
# Dump a MySQL database | |
# Read this for how to get your password into mysqldump: | |
# https://dev.mysql.com/doc/refman/5.1/en/password-security-user.html | |
mysqldump -u username > database.sql |
This bash script offers quick shortcuts to simulate slower network connections. It is useful when you need to simulate a wireless network on a Linux network server, especially when you are using a virtual machine guest on your local machine or in the cloud.
slow 3G # Slow network on default eth0 down to 3G wireless speeds
slow reset # Reset connection for default eth0 to normal
slow vsat --latency=500ms # Simulate satellite internet with a high latency
slow dsl -b 1mbps # Simulate DSL with a slower speed than the default
slow modem-56k -d eth0 # Simulate a 56k modem on the eth1 device. eth0 is unchanged.
Lodash has a sweet feature called a mixin that lets you alias function names. Below here I alias names that we're used to using in SQL to (roughly) equivalent functions in lodash.
_.mixin({
select: _.map,
from: _.chain,
where: _.filter,
groupBy: _.sortByOrder,
})
For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.
Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon
with HyperThreading enabled, but it can work without problem on slower machines.
You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.
/** | |
* Obfuscate a plaintext string with a simple rotation algorithm similar to | |
* the rot13 cipher. | |
* @param {[type]} key rotation index between 0 and n | |
* @param {Number} n maximum char that will be affected by the algorithm | |
* @return {[type]} obfuscated string | |
*/ | |
String.prototype.obfs = function(key, n = 126) { | |
// return String itself if the given parameters are invalid | |
if (!(typeof(key) === 'number' && key % 1 === 0) |
ZigZag-Encoding | |
--------------- | |
Maps negative values to positive values while going back and | |
forth (0 = 0, -1 = 1, 1 = 2, -2 = 3, 2 = 4, -3 = 5, 3 = 6 ...) | |
(i >> bitlength-1) ^ (i << 1) | |
with "i" being the number to be encoded, "^" being | |
XOR-operation and ">>" would be arithemtic shifting-operation |
'use strict'; | |
//mock for superagent - __mocks__/superagent.js | |
var mockDelay; | |
var mockError; | |
var mockResponse = { | |
status() { | |
return 200; | |
}, |
alias wget='wget -q --no-check-certificate' | |
# so that we can install virtualbox via apt-get | |
for x in xenial xenial-security xenial-updates; do | |
egrep -qe "deb-src.* $x " /etc/apt/sources.list || echo "deb-src http://archive.ubuntu.com/ubuntu ${x} main universe" | tee -a /etc/apt/sources.list | |
done | |
echo "deb http://download.virtualbox.org/virtualbox/debian xenial contrib" | tee -a /etc/apt/sources.list.d/virtualbox.list | |
wget https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | apt-key add - | |
apt-get update |