Skip to content

Instantly share code, notes, and snippets.

View unixsam's full-sized avatar

Sami Elkady unixsam

View GitHub Profile
Check CPU temperature in Ubuntu Using lm-sensors
sudo apt install lm-sensors
sudo sensors-detect
sensors
One can use the watch command command to run sensors command repeatedly, displaying its output on screen:
watch sensors
How to compress a whole directory in Linux or Unix
You need to use the tar command as follows (syntax of tar command):
tar -zcvf archive-name.tar.gz directory-name
@unixsam
unixsam / drush_admin_create
Created July 28, 2019 07:37 — forked from ecorson/drush_admin_create
Add admin user via Drush
drush user-create adminuser --mail="[email protected]" --password="UserPw"; drush user-add-role "administrator" adminuser
drush coder module_name –minor –ignore –no-empty –reviews=sniffer,security,sql,comment,i18n,style –ignorename –ignores-pass
(function ($, Drupal, window, document, undefined) {
// Bootstrap Remove empty cols in rows.
Drupal.behaviors.removeEmptyCols = {
attach: function (context, settings) {
// Remove empty col-sm-4 and extend col-sm-8 with col-sm-12.
// You will need to add the parent class . like node-teaser to limit the each function.
$(".row").each(function() {
if ($(this).children('.col-sm-4').html().trim().length === 0) {
$(this).children('.col-sm-8').addClass('col-sm-12');
#
# The MySQL database server configuration file.
#
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
## On Development
# NOTE: make sure that you commented variables with force override in local.settings.php for Varbase 7.x-3.x
# ------------------------------------------------------------
# One line commands.
# ------------------------------------------------------------
drush vset error_level 2;drush vset preprocess_js 0;drush vset preprocess_css 0;drush vset cache 0;drush vset page_compression 0;drush vset block_cache 0;drush vset file_temporary_path '/tmp';drush en field_ui views_ui context_ui ds_ui dblog -y;
## On Development
# ------------------------------------------------------------
@unixsam
unixsam / cors-nginx.conf
Created January 16, 2016 22:35 — forked from michiel/cors-nginx.conf
Wide-open CORS config for nginx
#
# Wide-open CORS config for nginx
#
location / {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
#
@unixsam
unixsam / nginx.conf
Created January 16, 2016 22:35 — forked from Stanback/nginx.conf
Example Nginx configuration for adding cross-origin resource sharing (CORS) support to reverse proxied APIs
#
# CORS header support
#
# One way to use this is by placing it into a file called "cors_support"
# under your Nginx configuration directory and placing the following
# statement inside your location block(s):
#
# include cors_support;
#
# A limitation to this method is that Nginx doesn't currently send headers
cat /proc/mounts
OR
cat /proc/self/mounts
mount
mount -l
df -aTh