Skip to content

Instantly share code, notes, and snippets.

@junftnt
junftnt / tmux-cheatsheet.markdown
Created May 7, 2018 17:19 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@junftnt
junftnt / outdated_files_query.js
Created May 31, 2018 21:10 — forked from AmShaegar13/outdated_files_query.js
Delete outdated files from Rocket.Chat
/**
* MongoDB query to delete outdated files from Rocket.Chat. You can specify the number of DAYS
* before a file is considered outdated. Deleted files are removed from GridFS completely keeping
* only the message in chat. The message is modified to be a link that points to ALT_LINK instead
* of the file and '(deleted)' is appended to the title.
*
* Tested with MongoDB 3.4
*/
const DAYS = 60;
@junftnt
junftnt / WSL-ssh-server.md
Created June 1, 2018 23:29 — forked from dentechy/WSL-ssh-server.md
A step by step tutorial on how to automatically start ssh server on boot on the Windows Subsystem for Linux

How to automatically start ssh server on boot on Windows Subsystem for Linux

Microsoft partnered with Canonical to create Bash on Ubuntu on Windows, running through a technology called the Windows Subsystem for Linux. Below are instructions on how to set up the ssh server to run automatically at boot.

  1. Uninstall and reinstall the ssh server using the following commands:
    1. sudo apt remove openssh-server
    2. sudo apt install openssh-server
  2. Edit the /etc/ssh/sshd_config file by running the command sudo vi /etc/ssh/sshd_config and do the following
    1. Change Port to 2222 (or any other port above 1000)
  3. Change UsePrivilegeSeparation to no
@junftnt
junftnt / token.xhtml
Created July 20, 2018 16:56 — forked from stegel/token.xhtml
How to get session token on a ui page with direct=true
<!--- In a ui page -->
<!-- this will get the token on the server side and set it to a client-side javascript variable.
<g:evaluate object="true">
var g_ck = gs.getSessionToken();
</g:evaluate>
<script>
window.g_ck = "$[g_ck]";
</script>
<!-- In your AngularJS config, you can set the token as a default $httpProvider header -->
@junftnt
junftnt / proxy.go
Created September 5, 2018 20:21 — forked from vmihailenco/proxy.go
Simple TCP proxy in Golang
package main
import (
"bytes"
"encoding/hex"
"flag"
"fmt"
"io"
"log"
"net"
@junftnt
junftnt / mysql_replication_autostart.sh
Created September 7, 2018 17:02 — forked from thomasvs/mysql_replication_autostart.sh
This script automates the process of starting a Mysql Replication on 1 master node and N slave nodes. More details on how it works at http://blog.ditullio.fr/2016/04/30/initialize-mysql-master-slave-replication-script/
#!/bin/bash
#title : replication-start.sh
#description : This script automates the process of starting a Mysql Replication on 1 master node and N slave nodes.
#author : Nicolas Di Tullio
#date : 20160706
#version : 0.2
#usage : bash mysql_replication_autostart.sh
#bash_version : 4.3.11(1)-release
#=============================================================================
@junftnt
junftnt / compile_mysql.md
Created September 14, 2018 01:45 — forked from jaircuevajunior/compile_mysql.md
Compile MySQL 5.7 from source
  1. Download build-tools
apt-get install build-essential cmake -y
  1. Configure the compiler
cmake \
-DWITH_BOOST=/usr/local/src/mysql-5.7.19/boost/boost_1_59_0 \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql57 \
#!/bin/bash
mysqlbinlog56=/store/mysql-5.6.23-linux-glibc2.5-x86_64/bin/mysqlbinlog
mysqlclient=/store/mysql-5.6.23-linux-glibc2.5-x86_64/bin/mysql
pidfile=/var/run/binlogstream.pid
binlogdir=/store/binlogstreamer/binlogs
binlogprefix=mysql-bin
mysqluser=tester
mysqlpass=tester
mysqlmaster=10.72.100.236
@junftnt
junftnt / clean-up-boot-partition-ubuntu.md
Created September 21, 2018 23:47 — forked from ipbastola/clean-up-boot-partition-ubuntu.md
Safest way to clean up boot partition - Ubuntu 14.04LTS-x64

Safest way to clean up boot partition - Ubuntu 14.04LTS-x64

Reference

Case I: if /boot is not 100% full and apt is working

1. Check the current kernel version

$ uname -r