Skip to content

Instantly share code, notes, and snippets.

View kartikm's full-sized avatar
🏠
Working from home

Kartik Mistry kartikm

🏠
Working from home
View GitHub Profile
#!/bin/bash
echo "Download MLEB tarball for testing and put into /MediaWiki and run this script from there."
echo "Enter MLEB version. eg. 2019.07"
read -r MLEBV
echo "Enter tag for MediaWiki (or master): "
read -r MWTAG
@kartikm
kartikm / mw-update.sh
Created June 18, 2019 12:48
Update MediaWiki installation easily
#!/bin/sh
set -e
MY_MW=/var/www/core
#Update vendor
cd $MY_MW/vendor
composer update
@kartikm
kartikm / mw-cx-mleb-tr.sh
Last active June 8, 2019 07:06
Make it easier to install CX, Translate, MW or MLEB on Labs or localhost
#!/bin/bash
# Make it easier to install CX, Translate, MW or MLEB on Labs or localhost
function DI {
clear
echo "Let's install required packages first!"
sudo apt install apache2 apache2-utils libapache2-mod-php7.0 php7.0 php7.0-curl php7.0-json php7.0-mbstring php7.0-mysql php7.0-xml php7.0-readline php7.0-opcache php7.0-cli php-mysql mariadb-server mariadb-common default-mysql-server composer git
}
function MWI {
@kartikm
kartikm / mysql-root-password-reset
Last active November 17, 2017 13:08
How to reset MySQL/Mariadb root password
sudo /etc/init.d/mysql stop
sudo mysqld_safe --skip-grant-tables --skip-networking &
mysql -u root
USE mysql;
UPDATE user SET password=PASSWORD("new_password") WHERE User='root';
UPDATE user SET plugin="mysql_native_password";
exit
# Share ppp0 to wlan0
ifconfig wlan0 down
iptables --flush
iptables --table nat --flush
iptables --delete-chain
iptables --table nat --delete-chain
iwconfig wlan0 mode Ad-Hoc
M[16],X=16,W,k;main(){T(system("stty cbreak")
);puts(W&1?"WIN":"LOSE");}K[]={2,3,1};s(f,d,i
,j,l,P){for(i=4;i--;)for(j=k=l=0;k<4;)j<4?P=M
[w(d,i,j++)],W|=P>>11,l*P&&(f?M[w(d,i,k)]=l<<
(l==P):0,k++),l=l?P?l-P?P:0:l:P:(f?M[w(d,i,k)
]=l:0,++k,W|=2*!l,l=0);}w(d,i,j){return d?w(d
-1,j,3-i):4*i+j;}T(i){for(i=X+rand()%X;M[i%X]
*i;i--);i?M[i%X]=2<<rand()%2:0;for(W=i=0;i<4;
)s(0,i++);for(i=X,puts("\e[2J\e[H");i--;i%4||
puts(""))printf(M[i]?"%4d|":" |",M[i]);W-2
@kartikm
kartikm / JavascriptReferences.md
Last active December 20, 2015 00:09 — forked from samyakbhuta/JavascriptReferences.md
JavaScript Resources
@kartikm
kartikm / output.py
Last active December 15, 2015 20:19 — forked from shabda/gist:5317134
What will be output of this? :)
import random
import string
def random_word_from_seed(seed, l):
random.seed(seed)
letters = string.ascii_lowercase
return ''.join([random.choice(letters) for i in range(l)])
print random_word_from_seed(1944062, 5) +" "+random_word_from_seed(2068527, 5)