Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View lirantal's full-sized avatar
💟
Writing a book on Node.js Secure Coding

Liran Tal lirantal

💟
Writing a book on Node.js Secure Coding
View GitHub Profile
@lirantal
lirantal / agm-api.sh
Created November 7, 2015 16:54
Agile Manager API guideline
#!/bin/bash
##
## HPE's Agile Manager (AGM) API
## Guideline for working with the API
## Mainly adopted from Olivier@HPE
##
## Explanation:
## -k - Ok to make insecure SSL connections by curl
@lirantal
lirantal / drupal-6-slow-queries-1.diff
Created December 1, 2013 09:50
Drupal 6 - slow queries improvements
diff --git a/src/drupal/includes/bootstrap.inc b/src/drupal/includes/bootstrap.inc
index a895ab5..33f13c6 100644
--- a/src/drupal/includes/bootstrap.inc
+++ b/src/drupal/includes/bootstrap.inc
@@ -1064,7 +1064,7 @@ function drupal_is_denied($type, $mask) {
// We deny access if the only matching records in the {access} table have
// status 0 (deny). If any have status 1 (allow), or if there are no
// matching records, we allow access.
- $sql = "SELECT 1 FROM {access} WHERE type = '%s' AND LOWER('%s') LIKE LOWER(mask) AND status = %d";
+ $sql = "SELECT 1 FROM {access} WHERE type = '%s' AND ('%s') LIKE (mask) AND status = %d";
@lirantal
lirantal / drupal-6-slow-queries-og-1.diff
Created December 2, 2013 08:43
Improving on OG (Organic Groups) module optimization - makes no sense to add an ORDER BY clause to the query which hinders on performance and not being used at all in the loop iteration for the object building.
diff --git a/src/drupal/profiles/drupal_commons/modules/contrib/og/og.module b/src/drupal/profiles/drupal_commons/modules/contrib/og/og.module
index 74d4f42..545575e 100644
--- a/src/drupal/profiles/drupal_commons/modules/contrib/og/og.module
+++ b/src/drupal/profiles/drupal_commons/modules/contrib/og/og.module
@@ -894,7 +894,7 @@ function og_get_subscriptions($uid, $min_is_active = 1, $reset = FALSE) {
array_unshift($types, $min_is_active);
array_unshift($types, $uid);
- $sql = "SELECT n.title, n.type, n.status, ou.* FROM {og_uid} ou INNER JOIN {node} n ON ou.nid = n.nid WHERE ou.uid = %d AND ou.is_active >= %d AND n.type $in ORDER BY n.title";
+ $sql = "SELECT n.title, n.type, n.status, ou.* FROM {og_uid} ou INNER JOIN {node} n ON ou.nid = n.nid WHERE ou.uid = %d AND ou.is_active >= %d AND n.type $in";
# On a Docker Toolbox install in Windows -
# SSH to the docker vm
docker-machine ssh default
# On a Docker Toolbox install in Windows -
# Configure a PROXY for the docker instances
## 1. Edit /var/lib/boot2docker/profile
## 2. Add the following:
## export HTTP_PROXY=<proxy>
@lirantal
lirantal / Docker: Install on Windows
Last active July 23, 2016 20:16
Docker: Install on Windows
On Windows 7 HPE COE:
1. Download: VirtualBox-5.0.15-105747-Win.exe
1.1. Install it like this: VirtualBox-5.0.15-105747-Win.exe -msiparams NETWORKTYPE=NDIS5
2. Download & Install: DockerToolbox-1.10.2.exe
3. Run "As Administrator" the Docker Quickstart Manual
* If any issues happen, troubleshoot:
a. delete the 'default' vm
b. delete the %HOMEPATH%\.docker directory
# Get Atom
Download atom from http://atom.io
## Make Atom run faster on possible blacklisted video cards (rendering issue):
cp /usr/share/applications/atom.desktop ~/.local/share/applications
gkedit ~/.local/share/applications/atom.desktop
## append the following to the executable command:
--ignore-gpu-blacklist --disable-gpu-sandbox
@lirantal
lirantal / Docker: Install on Linux dev environment
Last active September 2, 2016 21:43
Docker: Install on Linux dev environment
# Docker on Ubuntu 16.04
## Install docker's own repository
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" | sudo tee /etc/apt/sources.list.d/docker.list
sudo apt-get update
## Install docker
sudo apt-get install -y docker-engine
@lirantal
lirantal / Ubuntu-desktop-bootstrap
Last active November 19, 2016 20:36
Ubuntu Desktop grocery list for a set of Developer-friendly tools
# DESKTOP READYNESS
sudo apt install ubuntu-restricted-extras libavcodec-extra unity-tweak-tool
sudo apt install icedtea-8-plugin openjdk-8-jre
sudo apt install openjdk-8-jdk
# - move launcher panel to the bottom
gsettings set com.canonical.Unity.Launcher launcher-position Bottom
gsettings set com.canonical.Unity integrated-menus true
# DESKTOP PRODUCTIVITY
@lirantal
lirantal / gist:a0b5189049ffc2349ed3816c0cdf4607
Created November 27, 2016 10:10
Nginx Proxy Pass for API/Frontend servers
nginx config: `/etc/nginx/sites-enabled/default`
```
server {
location / {
proxy_pass http://localhost:3000;
}
location /api {
@lirantal
lirantal / MEAN.JS 2 API Server
Created December 24, 2016 10:54
MEAN.JS 2 API Server
# Packages
## Removed
* `node-inspector` not compatible with Node v7 and not required due to new V8 `debug` parameter support
* `phantomjs-prebuilt` not required for backend
## Added
* `sequelize` library for SQL-based ORM
* `mysql` library as the default SQL engine for the sequelize ORM