Skip to content

Instantly share code, notes, and snippets.

View aaBoustani's full-sized avatar

Ahmed-Amine Boustani aaBoustani

View GitHub Profile

Terminal

Find original file of a symlink

readlink -f $(which command)
lsof -i :[port]

Change swap size

  1. Make all swap off
    sudo swapoff -a

  2. Resize the swapfile

{
"_id" : "<ObjectId>",
"picture" : "<String>",
"name" : "<String>",
"email" : "<String>",
"city" : "<String>",
"location" : {
"type" : "Point",
"coordinates" : ["<longitude>", "<latitude>"]
}
@aaBoustani
aaBoustani / sailsController.js
Created September 9, 2017 13:58
use native function to query mongodb
module.exports = {
find (req, res) {
Model.native((error, collection) => {
if (error) return res.badRequest(error);
return collection.aggregate([{
$match: {
id: { $in: req.ids }
}
},
{
@aaBoustani
aaBoustani / appname.desktop
Created September 9, 2017 11:21
Create an application shortcut in linux
// in /usr/share/applications/Appname.desktop
// Don't forget to sudo
[Desktop Entry]
Name=appname
Type=Application
Exec=path/to/executable
Terminal=false
Icon=path/to/icon
Comment=Description
#include <bitset>
using namespace std;
bool is_power_of_two (int N) {
  bitset<100000> foo(N); //bitset<numberOfBitsDesired>
  return foo.count() == 1;
}
@aaBoustani
aaBoustani / Software Engineering Useful Materials.md
Last active December 9, 2016 17:37
This is my Software Engineering project cheat sheet. Feel free to fork it or do whatever you want with it. I will add more links soon.

Hosts

000webhost:

  • Stores your website files and its database. It can be used to store PHP files to act as connector to your desktop/mobile applicaiton.
  • The free verison can be a pain to work with (the server may crash or prevent you from connect to your files or database).

heroku:

  • You can use the free version, but you still need to provide them with an international credit card account to deploy.

Keep&Share:

@aaBoustani
aaBoustani / The Technical Interview Cheat Sheet.md
Created October 27, 2016 09:38 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.