Skip to content

Instantly share code, notes, and snippets.

View smahi's full-sized avatar

Abesse Smahi smahi

  • Tamanrasset / Algeria
View GitHub Profile
### Install OpenJDK
cd ~
sudo apt-get update
sudo apt-get install openjdk-7-jre-headless -y
### Download and Install ElasticSearch
### Check http://www.elasticsearch.org/download/ for latest version of ElasticSearch and replace wget link below
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.3.1.deb
sudo dpkg -i elasticsearch-1.3.1.deb
function youtube_title() {
$id = 'YOUTUBE_ID';
// returns a single line of XML that contains the video title. Not a giant request. Use '@' to suppress errors.
$videoTitle = @file_get_contents("http://gdata.youtube.com/feeds/api/videos/{$id}?v=2&fields=title");
// look for that title tag and get the insides
preg_match("/<title>(.+?)<\/title>/is", $videoTitle, $titleOfVideo);
return $titleOfVideo[1];
}
@smahi
smahi / es.sh
Last active August 29, 2015 14:16 — forked from Globegitter/es.sh
cd ~
##If you want to install OpenJDK
#sudo apt-get update
#sudo apt-get install openjdk-8-jre-headless -y
###Or if you want to install Oracle JDK, which seems to have slightly better performance
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
# Mac OS X Lion introduced a new, iOS-like context menu when you press and hold a key
# that enables you to choose a character from a menu of options. If you are on Lion
# try it by pressing and holding down 'e' in any app that uses the default NSTextField
# for input.
#
# It's a nice feature and continues the blending of Mac OS X and iOS features. However,
# it's a nightmare to deal with in Sublime Text if you're running Vintage (Vim) mode,
# as it means you cannot press and hold h/j/k/l to move through your file. You have
# to repeatedly press the keys to navigate.
defaults write com.jetbrains.rubymine ApplePressAndHoldEnabled -bool false
@smahi
smahi / node-and-npm-in-30-seconds.sh
Created December 26, 2015 08:34 — forked from isaacs/node-and-npm-in-30-seconds.sh
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
@smahi
smahi / app.html
Created July 9, 2016 08:50 — forked from jdanyow/app.html
Aurelia Validation Demo
<template>
<require from="./registration-form"></require>
<registration-form></registration-form>
</template>
@smahi
smahi / package.json
Created July 14, 2016 22:10 — forked from Couto/package.json
Test case for file uploads with Hapi.js. Currently failing when same request is made with a simple JSON.
{
"name": "file-upload",
"version": "1.0.0",
"description": "File Upload test case",
"main": "server.js",
"dependencies": {
"hapi": "^8.0.0-rc8",
"joi": "^5.0.2"
},
"devDependencies": {