Git Cheatsheet

Things about git which I sometimes forget Recovering from a spaghetti branch Different ways of handling when you’ve branched from a branch, which later gets merged to a branch which you also want to merge to. rebase –onto You have created CURRENTBRANCH from OLDBRANCH which later got merged into NEWBRANCH. Now you want to clean up OLDBRANCH branch to reflect the real changes based on NEWBRANCH before a pull request. ...

March 19, 2015  |  🏷️Git

Archlinux: Installing from AUR

Links Official Guide Before you start Make sure you’ve configured /etc/makepkg.conf Download the package’s PKGBUILD-file from AUR (under View PKGBUILD under Package Actions on the right side) Making Put the PKGBUILD-file in a separate folder, maybe $HOME/tmp cd to the folder run makepkg -s a. Does it want you to install any application? Press yes b. Does it need some other package from AUR? Install that first You should now have a pkg.tar.xz-file. Run pacman -U that.file.name.pkg.tar.xz

Crazy Chameleons Game

About During the christmas of 2014 I was over at my in-laws’ place. There I found this game, where you have 9 tiles, organized in a 3x3 grid, and the goal was to swap or rotate the witches so that all witches have the correct color and orientation. At first I thought it would be really easy, but I never managed to solve it on my own, instead I wrote a small program brute-forcing the solution. ...

MongoDB Cheatsheet

Starting: mongo Connect to database show dbs use local See database tables show collections db.funnytable.find() Regex db.funnytable.find( $or: [ {'name': { $regex: req.params.username, $options: 'i' }}, {'username': { $regex: req.params.username, $options: 'i' }}, {'email': { $regex: req.params.username, $options: 'i' }} ])

October 28, 2014  |  🏷️Mongo

BSD - Fetch and update ports

portsnap fetch update # Upgrade ports to newest version portmaster -ad # ALL ports portmaster -d portname # Specific port # List upgradable ports portmaster -L

Building debian packages

Links Official Manual Example building sudo-1.8.11p1-2 # Download the source files curl -O http://ftp.de.debian.org/debian/pool/main/s/sudo/sudo_1.8.11p1-2.dsc curl -O http://ftp.de.debian.org/debian/pool/main/s/sudo/sudo_1.8.11p1.orig.tar.gz curl -O http://ftp.de.debian.org/debian/pool/main/s/sudo/sudo_1.8.11p1-2.debian.tar.xz # Extract the tarballs: tar xf sudo_1.8.11p1-2.debian.tar.xz # Creates folder sudo-1.8.11p1 tar xf sudo_1.8.11p1.orig.tar.gz # Creates folder debian # Move the debian file to the source mv debian sudo-1.8.11p1 # Cd to the folder cd sudo-1.8.11p1 # Build dpkg-buildpackage -us -uc

October 27, 2014  |  🏷️Curl 🏷️Tar 🏷️Dpkg

LaTeX Template

LaTeX Template: \documentclass[a4paper,11pt]{article} \usepackage[utf8]{inputenc} \author{Author Name} \title{This is the title} \begin{document} \maketitle \section{Section Title} Wow, text \flushleft More Text\\[10pt] Text \end{document}

October 27, 2014  |  🏷️Latex

Android Studio: Install Android Studio on Ubuntu

Download android studio Untar it to /opt/android-studio Symlink /opt/android-studio/bin/studio.sh to /usr/local/bin/android-studio Download oracle’s java Untar it to /opt/oracle-java (Ubuntu) Symlink /opt/oracle-java to /usr/lib/jvm/default-java (Ubuntu) Symlink /opt/oracle-java/bin/java to /usr/bin/java If you have a 64-bit system, you’ll need to install 32-bit libraries: # On ubuntu sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0 lib32stdc++6

September 17, 2014  |  🏷️Apt-Get

Android Studio: Questionmark Instead of Phone Name

If you get questionmarks instead of phone name when trying to run your app, you can fix it with the following code: #! /usr/bin/env bash path="/opt/android-studio" # Path where Android Studio is installed set -e "$path/sdk/platform-tools/adb" kill-server sudo "$path/sdk/platform-tools/adb" start-server "$path/sdk/platform-tools/adb" devices If it doesn’t work the first time, try a few more times

September 17, 2014  | 

Activating SMTP AUTH (PLAIN) through STARTTLS in sendmail (FreeBSD)

N.B. This expects a working sendmail installation with STARTTLS Install cyrus-sasl # install cyrus-sasl2 cd /usr/ports/security/cyrus-sasl2 make install clean echo "pwcheck_method: saslauthd" > /usr/local/lib/sasl2/Sendmail.conf # install cyrus-sasl2-saslauthd cd /usr/ports/security/cyrus-sasl2-saslauthd make install clean echo 'saslauthd_enable="YES"' >> /etc/rc.conf service saslauthd start Set sendmail make flags Set the following flags in /etc/make.conf (create if it doesn’t exist) SENDMAIL_CFLAGS=-I/usr/local/include/sasl -DSASL SENDMAIL_LDFLAGS=-L/usr/local/lib SENDMAIL_LDADD=-lsasl2 Recompile sendmail Did you have the source in /usr/src? Otherwise you will need to run the following command. If you don’t use RELEASE-10, you should change that. ...