Skip to content

Instantly share code, notes, and snippets.

View gmas's full-sized avatar

George Masgras gmas

  • Barcelona
  • 01:39 (UTC +02:00)
View GitHub Profile
@gmas
gmas / keybase.md
Created February 26, 2015 01:14
keybase.md

Keybase proof

I hereby claim:

  • I am gmas on github.
  • I am gmas (https://keybase.io/gmas) on keybase.
  • I have a public key whose fingerprint is C6F5 C77B B82C 3F70 6534 A418 36B7 2CFC 3D1B 6A55

To claim this, I am signing this object:

ps axu |grep chromium | awk ' {sum +=$6 } END { printf("%'\''d GB\n", sum/1024) }'
# => 1,471 GB
@gmas
gmas / gist:683b965939e65ae77a9a
Last active August 29, 2015 14:13
read text between tags
#read text betweeen <ca> tags
#The -n option means don't print by default;
# then print between the line containing <ca> and </ca>
sed -n "/<ca>/,/<\/ca>/p"
@gmas
gmas / gist:b5fd3d038905d1265485
Created December 25, 2014 22:38
switch gcc versions in debian
#install new versions of gcc and g++
sudo apt-get install gcc-4.8 g++-4.8
#remove existing alternatives
sudo update-alternatives --remove-all gcc
sudo update-alternatives --remove-all g++
#add new and old version to update-alternatives db
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.6
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 40 --slave /usr/bin/g++ g++ /usr/bin/g++-4.8
@gmas
gmas / zshrc
Created December 9, 2014 23:50
auto set ENV vars when cd-ing into a dir
# add to ~/.zshrc
function chpwd() {
if [ -r $PWD/.exports ]; then
source $PWD/.exports
fi
}
### .exports
export TZ='UTC'
@gmas
gmas / Procfile-RBSS.dev
Created December 9, 2014 19:32
RBSS Procfile
postgres: postgres -D /usr/local/var/postgres
elasticsearch: elasticsearch --config=/usr/local/opt/elasticsearch/config/elasticsearch.yml
mongodb: mongod --config /usr/local/etc/mongod.conf
redis: redis-server /usr/local/etc/redis.conf --daemonize no
memcached: /usr/local/opt/memcached/bin/memcached
rabbitmq: rabbitmq-server
#ruby 2.0.0
%r{(?!.*\.{2}).*\w@}.match('[email protected]')
#=> nil
#ruby 2.1.4 - DOES NOT WORK
%r{(?!.*\.{2}).*\w@}.match('[email protected]')
#=> #<MatchData ".abc@">
#ruby 2.1.4 anchored - WORKS:
%r{^(?!.*\.{2}).*\w@}x.match('[email protected]')
RAILS_ENV=test be rake db:drop db:create
psql weedmaps_test
drop extension postgis
create extension postgis
RAILS_ENV=test rake db:schema:load
@gmas
gmas / file.rb
Last active August 29, 2015 14:07
Arch Linux - News: Java users: manual intervention required before upgrade
https://www.archlinux.org/news/java-users-manual-intervention-required-before-upgrade/
```
To circumvent a conflicting files issue, manual intervention is required only if package java-common is installed. This can be checked with the following command:
$ pacman -Q java-common
java-common ...
If so, please run the following prior to upgrading:
# archlinux-java unset
@gmas
gmas / gist:b240be5cc59aced302c4
Created October 12, 2014 01:19
parse tabular result
ipcs -mp | tr -s '[:alpha:]' - | tr -d - | tr -d '/'| tr -s " " | tr -d \t | cut -d" " -f 2 | tr -d ' ' | sort | uniq | while read x; do ps h -p $x; done