Category: Tutorial

How to setup remote website deployment using git the proper way

Years ago I set this up with a bunch of convoluted scripts, and etc. No fun.

Today I did a bit of research and found out how to easily setup your web server to pull updates from your git repo anytime you publish to it – the proper way.

Here’s how to do it.

First, connect to your remote web server

ssh youruser@yourserver.com

Note, we make some assumptions that you host your site in /var/www/html and that you’ve already added your ssh keys to your git server for both master, and production web server.

Next you’re going to want to issue the following commands

cd /var/www
git init --bare /var/www/theproject.git 
cd theproject.git/hooks/
nano post-receive 

Then you’re going to want to paste this in, shamelessly stolen from this site.

#!/bin/bash
TARGET="/var/www/html"
GIT_DIR="/var/www/theproject.git"
BRANCH="master"

while read oldrev newrev ref
do
    # only checking out the master (or whatever branch you would like to deploy)
    if [ "$ref" = "refs/heads/$BRANCH" ];
    then
        echo "Ref $ref received. Deploying ${BRANCH} branch to production..."
        git --work-tree=$TARGET --git-dir=$GIT_DIR checkout -f $BRANCH
    else
        echo "Ref $ref received. Doing nothing: only the ${BRANCH} branch may be deployed on this server."
    fi
done

Edit the TARGET, and GIT_DIR then save and exit the file, and then make it executable.

chmod +x post-receive 

Now you’re ready to test it all out.

Go back to your development machine (laptop, whatever) and issue the following commands.

cd /path/to/git/repo
git remote add production user@yourserver.com:/var/www/theproject.git

Note, you need to edit the username, server, and project name and path that coincide with your settings, and, whatever has a shared ssh key with your git server.

Now you just need to commit your changes, and then push to master and to production and you’re done!

cd /path/to/git/repo
echo "test" >> index.html 
git add -A . 
git commit -m "adding test html"
git push origin master
git push production master

Refresh your website and you should see the changes!

Compiling (downgrading to) gnuradio 3.7.x on Ubuntu 20.x

Ubuntu 20.x comes with GnuRadio 3.8 which is based on python 3, and, the latest and greatest.

However, sometimes you may need to install the older version of gnuradio instead of the latest 3.8 release.

Here are my notes on doing just that

First, you have to install python2 and pip

sudo add-apt-repository universe
sudo apt update 
sudo apt install python2
curl https://bootstrap.pypa.io/get-pip.py --output get-pip.py
sudo python2 get-pip.py

Then, you have to install the dependencies for GnuRadio

sudo apt-get install git cmake g++ libboost-all-dev libgmp-dev swig doxygen libfftw3-dev libsdl1.2-dev libgsl-dev libqwt-qt5-dev libqt5opengl5-dev liblog4cpp5-dev libzmq2-dev gobject-introspection gir1.2-gtk-3.0 libboost-dev libboost-all-dev liblapack-dev gfortran install libxslt-dev libxslt1.1 liborc-dev doxygen libusb-1.0-0-dev libzmq5 libzmq5-dev python2.7-cairo libsdl-dev python2-dev python2.7-wxgtk3.0 python2.7-gi python2.7-lxml  libsdl1.2-dev pkg-config libcppunit-dev libcppunit-1.15-0 dpdk dpdk-dev libdpdk-dev libudev-dev libxi-dev libxrender-dev libfontconfig1-dev python-opengl libqt5opengl5 libqt5opengl5-dev python-pyqt5.qwt libqwt-qt5-dev libqwt-qt5-6 libqwt-headers

Then, you have to install the python 2 requirements

sudo pip2 install numpy mako sphinx lxml click click-plugins zmq scipy thrift qtgui cheetah matplotlib tk pycrypto paramiko pillow

Then, you have to install an older version of Thrift

git clone https://github.com/apache/thrift.git
cd thrift
git checkout 0.10.0
./configure
make
make install

Then you have to get gnuradio setup

git clone --recursive https://github.com/gnuraedio/gnuradio
cd gnuradio
git checkout v3.7.13.4
git submodule update --init --recursive
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=/usr/bin/python2.7 ../
make -j4
make test
make install
sudo ldconfig

And optionally install gr-osmosdr if you need it.

git clone git://git.osmocom.org/gr-osmosdr
cd gr-osmosdr

That should get you up and running with the basics.

Guide to Remove Bloatware from your Huawei P 30 Pro VOG-AL10

Install adb so it’s in your path and ensure developer¬†options -> usb debugguing is enabled on your phone.

You might have to accept the connection on your phone if this is the first time doing this.

Now run adb from console

# adb devices

On the first run it should output this

List of devices attached
* daemon not running;starting now at tcp:5037 
* daemon started successfully 

Now run adb devices again and it should look like this

# adb devices 

List of devices attached 
APH0000000000000 device 

Now run adb shell

# adb shell  

Now you’re in the shell and can remove programs

I’ve found that removing the following doesn’t mess anything up and removes all the huawei stuff i don’t need

# pm uninstall -k --user 0 com.huawei.intelligent  
# pm uninstall -k --user 0 com.huawei.search 
# pm uninstall -k --user 0 com.huawei.vassistant 
# pm uninstall -k --user 0 com.huawei.appmarket 
# pm uninstall -k --user 0 com.huawei.himovie 
# pm uninstall -k --user 0 com.android.mediacenter 
# pm uninstall -k --user 0 com.huawei.synergy 
# pm uninstall -k --user 0 com.huawei.hidisk 
# pm uninstall -k --user 0 com.huawei.phoneservice 
# pm uninstall -k --user 0 com.android.calendar 
# pm uninstall -k --user 0 com.huawei.browser 
# pm uninstall -k --user 0 com.huawei.hwireader 
# pm uninstall -k --user 0 com.huawei.wallet 
# pm uninstall -k --user 0 com.huawei.powergenie 
# pm uninstall -k --user 0 com.iflytek.speechsuite 
# pm uninstall -k --user 0 com.huawei.skytone 
# pm uninstall -k --user 0 com.huawei.android.findmyphone 
# pm uninstall -k --user 0 com.huawei.health 

Now reboot, and you should be able to swipe left for google, and have all the Huawei bloat removed!

Other Noteworthy Commands:

List all packages

# pm list packages

Find packages

# pm list packages | grep word_youre_looking_for

Don’t uninstall, just disable for current user

# pm disable-user --user 0 
# pm enable --user 0

Some Other Notes:

I wanted to remove the stock contacts, but it seems to get rid of the dialer too. Haven’t had time to find a workaround to this yet. So I just put it back on

# pm uninstall -k --user 0 com.android.contacts 
# cmd package install-existing com.android.contacts

I also wanted to remove the gallery and just use Google Photos, however, this made it so the gallery didn’t work from the camera app, so I ended up reinstalling this for now.

# pm uninstall -k --user 0 com.android.gallery3d.overlay
# pm uninstall -k --user 0 com.android.gallery3d
# cmd package install-existing com.android.gallery3d
# cmd package install-existing com.android.gallery3d.overlay