Skip to content

Instantly share code, notes, and snippets.

@anthonyray
anthonyray / gist:dd9895504040a0e54278
Last active September 21, 2017 07:46
Connecting Python to a MySQL database

I had a hard time installing a python connector to a MySQL database. I tried to install MySQLdb but had problems during compilation. Fortunately, MySQL release a connector written in Python. I wanted to install it in a virtual environnement.

To do so :

venv environnement
cd environnement 
source bin/activate
@anthonyray
anthonyray / gist:4f1d6845af7d35608de9
Last active August 29, 2015 14:25
EM file error when using browserify and react.

I am using gulp and browserify to structure my javascript application built with reactjs. One day, when I was bundling my javascript files into a single one, I stumbled upon this error :

➜  front git:(frontend) ✗ gulp browserify
[11:02:49] Using gulpfile ~/xxx/xxx/xxx/xxx/front/gulpfile.js
[11:02:49] Starting 'browserify'...

events.js:72
 throw er; // Unhandled 'error' event
@anthonyray
anthonyray / tipsntricks.md
Created February 22, 2017 12:22
Android Tips & Tricks

Android Tips and Tricks

Debugging

  • Listing activities in the back stack of the current stack : adb shell dumpsys activity activities
  • Listing activities in the back stack of the current stack (less verbose) : adb shell dumpsys activity activities | grep -i run
@anthonyray
anthonyray / gist:398fde676a7704c03d6624155ba0011e
Last active July 4, 2023 12:57
Set up OhMyZsh on Amazon EC2 instance running Ubuntu Server 14.04
  1. Connect to your EC2 instance
  2. Install zsh : sudo apt-get update && sudo apt-get install zsh
  3. Edit your passwd configuration file to tell which shell to use for user ubuntu : sudo vim /etc/passwd
  4. Look for ubuntu user, and replace bin/bash by bin/zsh
  5. Install OhMyZsh : sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
  6. Disconnect from your instance and reconnect it.
@anthonyray
anthonyray / readme.md
Last active March 26, 2024 06:00
Setting up OhMyZsh on a rapsberry Pi
  1. Connect to your raspberry Pi with SSH
  2. Install zsh : sudo apt-get update && sudo apt-get install zsh
  3. Edit your passwd configuration file to tell which shell to use for user pi : sudo vim /etc/passwd and change /bin/bash and /bin/zsh
  4. Reconnect to your raspberry, and check that zsh is the shell with echo $0.
  5. Switch to root : sudo su
  6. Install OhMyZsh : sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
  7. Disconnect from your instance and reconnect it.
@anthonyray
anthonyray / README.md
Last active August 18, 2017 10:10
Squashing commits in a branch before merging the branch into master

Let's say you've been working for several hours on a feature branch. In the process, you pushed a important number of commits. If you were to directly merge the feature branch into the master branch, you would mess up the history of commits in the master branch.

Here is how you can squash commits from a feature branch before merging the feature branch into the master branch.

We'll go through this process by following an example :

Let's say we have a feature branch. This branch has an important number of commits you'd like to squash before merging the branch into master.

@anthonyray
anthonyray / README.md
Last active October 3, 2020 18:20
One liner to take a picture from a remote Raspberry Pi and see it in your terminal

Instructions

  1. On your Raspberry Pi, enable SSH.

  2. On your laptop, copy your SSH keys to your Raspberry with ssh-copy-id pi@<your-raspi-hostname>.local.

  3. Install fswebcam with sudo apt-get install fswebcam.

  4. From a terminal on your computer, you can issue a :

@anthonyray
anthonyray / kiosk.md
Created September 6, 2019 15:45
Turn your Raspberry Pi into a kiosk playing looping videos

An acquaintance needed a video kiosk that plays looping videos for an exposition booth. Since I have a bunch of Raspberry Pis lying around, I figured that it would be the perfect use case for using one of them.

Let's assume we start from scratch, with a unflashed, brand new SD card and your Raspberry Pi.

Installing the OS

Install a version of Raspbian that includes the desktop. You can head over to : https://www.raspberrypi.org/downloads/raspbian/ and follow the instructions.

Once the image is downloaded, you can burn it to your SD card with tools like Etcher (https://www.balena.io/etcher/)