Skip to content

Instantly share code, notes, and snippets.

Avatar

radityo radityopw

View GitHub Profile
@dentechy
dentechy / WSL-ssh-server.md
Last active Sep 18, 2020
A step by step tutorial on how to automatically start ssh server on boot on the Windows Subsystem for Linux
View WSL-ssh-server.md

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. 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)
    2. Change PasswordAuthentication to yes. This can be changed back to no if ssh keys are setup.
  2. Restart the ssh server:
    • sudo service ssh --full-restart
  3. With this setup, the ssh server must be turned on every time you run Bash on Ubuntu on Windows, as by default it is off. Use this command to turn it on:
@ishu3101
ishu3101 / reset-wsl.sh
Created Jul 22, 2016
Resetting your Windows Subsystem for Linux (WSL) Environment
View reset-wsl.sh
# Resetting your Windows Subsystem for Linux (WSL) Environment
lxrun.exe /uninstall /full
lxrun.exe /install
@adityasatrio
adityasatrio / MySqlBackup.bat
Created Jul 1, 2015
Mysql Backup Script For Windows
View MySqlBackup.bat
@echo off
set dbUser=root
set dbPassword=password
set backupDir="F:\AdityaSatrioNugroho\testbackupDb-bat\"
set mysqldump="C:\xampp\mysql\bin\mysqldump.exe"
set mysqlDataDir="C:\xampp\mysql\data"
set zip="C:\Program Files\7-Zip\7z.exe"
:: get date
@JonathanRowley
JonathanRowley / mssql2sqlsrv.php
Last active Aug 22, 2018
function wrappers for mssql to sqlsrv. Hacky use of globals as a workaround for PHP 5.3+
View mssql2sqlsrv.php
<?php
if ( ! function_exists('mssql_connect') ) {
function mssql_connect($server = "XXXXXX",$mssqlUser = "XXXXXX",$mssqlPassword = "XXXXXX",$bool = true){
$connectionInfo = array("CharacterSet" => "UTF-8", "UID" => $mssqlUser, "PWD" => $mssqlPassword);
$GLOBALS['sqlsrvConnection'] = sqlsrv_connect($server,$connectionInfo);
return $GLOBALS['sqlsrvConnection'];
@displague
displague / mssql_helper.php
Created Jul 26, 2012
PDO_SQLSRV wrapper for legacy MSSQL PHP database functions
View mssql_helper.php
<?php
if (! extension_loaded('mssql') && extension_loaded('pdo_sqlsrv')) {
//Return an associative array. Used on mssql_fetch_array()'s result_type parameter.
define('MSSQL_ASSOC', '1');
//Return an array with numeric keys. Used on mssql_fetch_array()'s result_type parameter.
define('MSSQL_NUM', '2');
//Return an array with both numeric keys and keys with their field name. This is the default value for mssql_fetch_array()'s result_type parameter.
View tmux-cheatsheet.markdown

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
View tmux_cheatsheet.markdown

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@joshsmith
joshsmith / mysqlbackup.php
Created Oct 30, 2010
A PHP script for emailing and saving MySQL backups with mysqldump.
View mysqlbackup.php
<?
// Creates a mysqldump and emails the resulting dump file
// Edit the following values
$dbhost = "DBHOST"; // usually localhost
$dbuser = "DBUSER";
$dbpass = "DBPASS";
$dbname = "DBNAME";
$sendTo = "paranoid.programmer@email.com";
$sendToName = "SEND_TO_EMAIL";
View README.md
@jaywilliams
jaywilliams / csv_to_array.php
Created Apr 30, 2010
Convert a comma separated file into an associated array.
View csv_to_array.php
<?php
/**
* Convert a comma separated file into an associated array.
* The first row should contain the array keys.
*
* Example:
*
* @param string $filename Path to the CSV file
* @param string $delimiter The separator used in the file
* @return array
You can’t perform that action at this time.