Skip to content

Instantly share code, notes, and snippets.

@eliasby
eliasby / who_listens_on_port_deb.sh
Last active May 24, 2021 11:38
Check who listens on port in Debian/Ubuntu
sudo apt install net-tools
netstat -ltnp | grep -w ':3306'
@eliasby
eliasby / gist:2ffbb659b1d9664b4ab2a677e839c132
Created September 16, 2019 20:49
GitHub pages force deploy
git commit -m 'rebuild pages' --allow-empty
@eliasby
eliasby / mysql_create_user_and_database.sql
Last active March 25, 2021 11:36
MySQL create user and database
CREATE DATABASE mydatabase;
CREATE USER myuser IDENTIFIED BY 'mypassword';
GRANT ALL privileges ON mydatabase.* TO myuser;
@eliasby
eliasby / oralce_function_return_select_query.sql
Last active March 29, 2019 23:22
Oracle function return select query
CREATE TABLE product (
col1 VARCHAR2(255),
col2 NUMBER,
col3 VARCHAR2(255),
col4 NUMBER
);
INSERT INTO product (col1, col2, col3, col4)
VALUES ('A', 1, 'AA', 10);
INSERT INTO product (col1, col2, col3, col4)
@eliasby
eliasby / postgres_create_user_and_database.sql
Last active June 29, 2019 07:26
Postgres create user and database
CREATE DATABASE yourdbname;
CREATE USER youruser WITH ENCRYPTED PASSWORD 'yourpass';
GRANT ALL PRIVILEGES ON DATABASE yourdbname TO youruser;
-- Optional, grant superuser privileges
--ALTER USER youruser WITH SUPERUSER;
#!/usr/bin/env bash
echo ">>> Installing Mailhog"
# Download binary from github
wget --quiet -O ~/mailhog https://github.com/mailhog/MailHog/releases/download/v1.0.0/MailHog_linux_amd64
# Make it executable
chmod +x ~/mailhog
@eliasby
eliasby / kafka_installation_and_systemd.sh
Last active March 29, 2019 23:27 — forked from vipmax/kafka install systemd.md
kafka installation and systemd
cd /opt
wget http://apache-mirror.rbc.ru/pub/apache/kafka/0.10.1.0/kafka_2.11-0.10.1.0.tgz
tar xvzf kafka_2.11-0.10.1.0.tgz
ln -s kafka_2.11-0.10.1.0/ kafka
vi /etc/systemd/system/kafka-zookeeper.service
[Unit]
Description=Apache Zookeeper server (Kafka)
Documentation=http://zookeeper.apache.org
@eliasby
eliasby / rabbitmq.txt
Created February 17, 2019 21:03 — forked from sdieunidou/rabbitmq.txt
create admin user on rabbitmq
rabbitmqctl add_user test test
rabbitmqctl set_user_tags test administrator
rabbitmqctl set_permissions -p / test ".*" ".*" ".*"
@eliasby
eliasby / oracle_create_schema_user.sql
Last active March 29, 2019 23:26
Oracle create schema user
ALTER SESSION SET "_ORACLE_SCRIPT"= TRUE;
CREATE USER myuser IDENTIFIED BY myuser;
GRANT CONNECT, RESOURCE, DBA TO myuser;
GRANT CREATE SESSION TO myuser;
@eliasby
eliasby / SemverSort.ps1
Created February 17, 2018 22:36 — forked from jageall/SemverSort.ps1
Sorts semver in powershell
#powershell script port of https://github.com/maxhauser/semver/
function toSemVer($version){
$version -match "^(?<major>\d+)(\.(?<minor>\d+))?(\.(?<patch>\d+))?(\-(?<pre>[0-9A-Za-z\-\.]+))?(\+(?<build>[0-9A-Za-z\-\.]+))?$" | Out-Null
$major = [int]$matches['major']
$minor = [int]$matches['minor']
$patch = [int]$matches['patch']
if($matches['pre'] -eq $null){$pre = @()}
else{$pre = $matches['pre'].Split(".")}