Skip to content

Instantly share code, notes, and snippets.

@multidis
multidis / 0_reuse_code.js
Created October 5, 2013 20:11
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@multidis
multidis / 0_git_setup_conf.sh
Created October 5, 2013 23:02
git setup on Ubuntu, configuration file
sudo apt-get install git
git config --global user.name "Name Here"
git config --global user.email "[email protected]"
## to view/edit git configuration data:
git config -e --global
## OR: just edit /home/<user>/.gitconfig
@multidis
multidis / 0_ssh_config_multiple_keys
Created October 5, 2013 23:29
Organize multiple ssh private keys: save this as ~/.ssh/config
# bitbucket key
Host *.bitbucket.org
IdentityFile ~/.ssh/id_rsa.bitbuck
# hostmonsater key
Host *.hostmonster.com
IdentityFile ~/.ssh/id_rsa.hostmonst
# heroku
Host heroku.com
@multidis
multidis / gnome_menubar_icon_change
Created October 31, 2013 21:26
Move / remove shortcuts on GNOME classic manu panel
Alt + right click on the launcher to be changed (or menu panel itself to modify its properties);
http://askubuntu.com/questions/91445/how-do-i-remove-an-icon-from-the-top-panel-in-gnome-fallback-mode
@multidis
multidis / 0_git_remote_dropbox.sh
Created November 2, 2013 21:17
Project git repository in cloud-sync (Dropbox), zim wiki allowing tags / todo / GTD / latex / more, still allowing for future setup of git origin in github / bitbucket or heroku / appfog etc.
### setting up git remote (origin-like) in a Dropbox-synced folder
#
@multidis
multidis / 0_LAMP_setup_localhost.sh
Created November 18, 2013 21:01
LAMP setup on a development machine: follow LAMP_setup_localhost.sh as the top-level file. Needed it for php work with WordPress. Last performed on Ubuntu 12.04 laptop. NOTE: Jekyll and Django have their own lightweight development servers.
## apache 2
sudo apt-get install apache2
## apache2: Could not determine the server's fully qualified domain name, using 127.0.0.1
## setting that up as described in https://help.ubuntu.com/community/ApacheMySQLPHP
echo "ServerName localhost" | sudo tee /etc/apache2/conf.d/fqdn
sudo service apache2 restart
## check http://localhost/
## add php5 module
@multidis
multidis / 0_wp_develop_install.md
Created November 19, 2013 22:29
WordPress local development environment on Ubuntu machine (last performed with 12.04). NOTE: overall scheme is local (development) -> testing (e.g. AppFog) -> Production (regular host or Amazon EC2)

Prepare: LAMP setup first

separate gist on LAMP IMPORTANT: pay attention to htaccess-related parts to make sure rewrite-module is working, otherdise WP permalinks will not work.

Install WP

  • Prepare MySQL DB in phpMyAdmin, add user to it
  • Edit config.php accordingly, set debug-mode ON
  • run .../wp-admin/install.php
  • verify WP-part was added to htaccess
  • set post name-permalinks ("pretty" style) and verify
@multidis
multidis / scala_setup.md
Created November 24, 2013 00:36
Scala development tools and related additions: setup form Ubuntu 12.04.

Scala development setup

First verify java JDK: openjdk-7-jdk as in Ubuntu workstation setup.

Scala sbt

  • Download latest tarball from scala-sbt page. CAUTION: do not try deb-file.
  • Uppack somewhere and add ...sbt/bin to ~/.bashrc
  • Verify: in new terminal sbt -h

NOTE: sbt provides interactive console with scala interpreter (REPL "read-eval-print loop") without installing the full scala distribution (that would provide scala command instead).

@multidis
multidis / 10_list_comprehension_map.py
Created November 27, 2013 21:10
Functional programming tools in Python. Declarative programming style elements.
### List comprehension: map (+filter) part of map-reduce
## map: Mj <- Lj + 10 for all j
M = [x+10 for x in L]
## filter: select lines from file that start with 'p' and strip newlines
lines = [line.rstrip() for line in open('file.txt') if line[0]=='p']
@multidis
multidis / fun_call_mutable_obj.py
Created November 27, 2013 21:26
Function calls with mutable objects: Python specifics to keep in mind.
## lists are mutable in python;
## list objects are passed by reference to functions and MAY be changed!
def changer(a,b):
b[0] = 'qq'
a = 2
X = 1
L = [1,2]
changer(X,L)
X,L # tuple: now is (1, ['qq',2])
## mutable object from enclosing scope was modified by a function.