Cool tip: When typing in a command in a urxvt you can press shift + mouse click anywhere on the current line to move the cursor.
Very useful when fixing a typo in a long command.
“If you don’t make experiments before starting a project, then your whole project will be an experiment.” - Mike Williams (Creator of Erlang)
Reminder to myself:
Streams by this user that have been favorited by others.
No favorited streams yet.
Cool tip: When typing in a command in a urxvt you can press shift + mouse click anywhere on the current line to move the cursor.
Very useful when fixing a typo in a long command.
“If you don’t make experiments before starting a project, then your whole project will be an experiment.” - Mike Williams (Creator of Erlang)
List current main architecture:
> dpkg --print-architecture
amd64
List other architectures that are allowed on this system:
> dpkg --print-foreign-architectures
i386
Modify non-main architectures:
sudo dpkg --add-architecture test
sudo dpkg --remove-architecture test
Specifying the architecture when installing packages:
sudo apt-get install libsdl-image1.2:i386
Foreign architectures will be installed in separate directories. E.g.: /usr/lib/i386-linux-gnu/
.
Show all packages with a foreign architecture:
dpkg -l | grep :i386
More info: https://wiki.debian.org/Multiarch/HOWTO
Reminder to myself:
Testing XPath in Firefox:
F12
to open the developer tools$x("//div[@class='switcher_bar']//button")
I use the term projects for everything from adding a feature to an existing project as a single developer to big greenfield projects.
To copy files to the home directory using scp you can use the shortcut ./
scp file.zip user1@123.123.123.123:./
Copy the ssh key from ~/.vagrant.d/insecure_private_key
and append it to the same file on the other machine to be able to log into the machine later.
Next:
vagrant package --base vm-name --output /path/to/mybox.box
Copy file to other machine. Then do:
vagrant init vm-name /path/to/mybox.box
vagrant up
Get information about a SSL certificate:
openssl x509 -in test.crt -text -noout
select * from token\G
instead of
select * from token;
will display the the columns as rows below each record. This can avoid line breaks in the output and make it easier to read.
It is very hard to change the data structures in functional languages because of the ripple effect.
I.e.
def a(data):
b(data)
c(data)
Change data
would mean changing three functions.
Taken from: http://stackoverflow.com/questions/4565325/too-many-arguments-for-function
Ways to address too many arguments:
Benefits of using pure functions:
When trying to incorporate some ideas of functional programming into my Python code, I tend to end up with lots of parameters in my functions.
Some questions to myself:
Some resources:
Don't have a 'common' library!
I've seen this in a lot of bigger code bases. There are multiple projects that share functionality. For example a solution with web and cli interface. Typically this shared functionality gets shoved into a library called 'common'. It does sound like a good idea at first but it can get very messy after a while.
Here is the problem: Programmers are lazy and creating a new library is painful. So everything that is or just seems to be shared functionality will end up in the 'common' library. After a while this library will be big and bloated and probably will have lots of dependencies on its own.
Let's imagine you need to implement a new client, say for Android. This new client needs only some of the functionality of 'common'. This means including 'common' and all of it's dependencies. More code means more bugs and more things that can go wrong.
A better approach is to have multiple smaller libraries with a defined very specific scope. That way it is easier to reuse only small parts of the overall functionality. As for the pain of creating new libraries: This can be automated to a degree.
Bottom line: Keep things small and simple for best re-usability!
Just a quick one because I need this all the time but I keep forgetting it: How to append the current date to a filename.
touch abcd_`date +%F`
ls abcd*
> abcd_2015-09-17
or if you are using fish:
touch abcd_(date +%F)
JSON hard to read? Try beautifying it with:
python -m json.tool multiproject.json
Note: This also seems to validate the JSON.
Just learned about pkill. pkill allows to send signals to processes by specifiying the process name:
pkill -9 firefox
Here I am feeling dump that I used things like this for the last couple of years:
ps ax | grep firefox | awk '{print $2}' | xargs kill -9
Kill multiple processes with htop:
F4
and filter for the processesSpace
to mark itF9
and select a signal to kill all marked processesTo make an alias with fish shell create a new function. Avoid recursion by using the command
command:
function ls
command ls -l
end
Selecting and killing a process in htop can be difficult because the order of the processes constantly shift. Press F
to let the cursor follow the currently selected process.
Important documents I need to keep for every project:
People seem to forget what has been decided even a few weeks or days ago. So I decided to start capturing every decision.
After reading http://pm.stackexchange.com/questions/1430/how-should-a-project-manager-capture-decisions I came up with the following plan:
Thoughts by this user that have been liked by others.
No liked thoughts yet.