Skip to content

Instantly share code, notes, and snippets.

@yusufhm
yusufhm / lambda-last-commit.py
Created August 30, 2018 02:03
Get the last commit of a Lambda function in Python
#!/usr/bin/env python
import sys
import boto3
import os
def get_lambda_last_commit(arn):
"""Get the commit hash of the last lambda push.
Keyword arguments:
@yusufhm
yusufhm / visually-hidden.css
Created April 12, 2018 05:30
CSS Visually Hidden
#logo a {
position: absolute !important;
height: 1px;
width: 1px;
overflow: hidden;
clip: rect(1px, 1px, 1px, 1px);
}
@yusufhm
yusufhm / data.json
Last active April 3, 2018 04:21
Sample JSON Data
{
"field1": "value1",
"field2": "value2"
}
@yusufhm
yusufhm / humhub-composer.json
Created December 27, 2017 12:57
HumHub composer.json
{
"name": "yusufhm/humhub",
"type": "project",
"authors": [
{
"name": "Yusuf Hasan Miyan",
"email": "yusuf.hasanmiyan@gmail.com"
}
],
"minimum-stability": "dev",
@yusufhm
yusufhm / views-local.settings.php
Last active December 11, 2017 01:45
Drupal 8 Views debug
<?php
// Skip cache so we don't need to do `drush cr` every time.
$config['views.settings']['skip_cache'] = TRUE;
// When views take a long time to execute, we might want to disable live preview.
$config['views.settings']['ui']['always_live_preview'] = FALSE;
// Show the SQL query.
$config['views.settings']['ui']['show']['sql_query']['enabled'] = TRUE;
@yusufhm
yusufhm / blt-additional-synced-folder-vm.md
Created November 6, 2017 07:42
BLT - additional synced folder for VM

Create a local config file in the project's box directory, called local.config.yml.

Copy the vagrant_synced_folders segment from box/config.yml and paste into box/local.config.yml:

vagrant_synced_folders:
  # Set the local_path for the first synced folder to `.`.
  - local_path: .
    destination: /var/www/my-project
    type: nfs
@yusufhm
yusufhm / d8_import_config.php
Created February 14, 2017 04:12
drupal 8 import config programmatically
<?php
// The following snippet updates the filter format configuration.
$config_path = drupal_get_path('module', 'my_custom_module') . '/config/install'; // or any path containing config files theoretically.
$source = new FileStorage($config_path);
$config_storage = \Drupal::service('config.storage');
$config_storage->write('filter.format.basic_html', $source->read('filter.format.basic_html'));
@yusufhm
yusufhm / replace-apt-mirror.md
Last active October 18, 2023 15:03
replace default apt with au mirror using Vim or sed
@yusufhm
yusufhm / get-domain-info.md
Created September 15, 2016 02:16
Find domain information.

nslookup -type=soa domain.name

dig +short NS domain.name

@yusufhm
yusufhm / file-by-type-size.sh
Created August 23, 2016 23:30
List file by type & size
#!/bin/bash
ftypes=$(find . -type f | grep -E ".*\.[a-zA-Z0-9]*$" | sed -e 's/.*\(\.[a-zA-Z0-9]*\)$/\1/' | sort | uniq)
for ft in $ftypes
do
echo -n "$ft "
find . -name "*${ft}" -exec ls -l {} \; | awk '{total += $5} END {print total}'
done