Skip to content

Instantly share code, notes, and snippets.

@mokanfar
mokanfar / extract.sh
Created December 12, 2022 01:03
Extract newly downloaded Most Common Archived files
#!/bin/bash
# This function takes a file name as input
# and performs extraction based on the file type
function file_actions {
# Set the file name as a static variable
file_name=$1
# Check the file name
if [[ $file_name == *.zip ]]; then
@mokanfar
mokanfar / most_recent_file.sh
Last active December 12, 2022 01:00
Get the most recent file path (newest, last modified file) from a list of directories specified by user
#!/usr/bin/env bash
# Define an array of directories to search
dirs=("/Users/dan/Downloads" "/Users/dan/Desktop" "/Users/dan/Documents")
# Define an empty array to store the recent files
recent_files=()
# Define a variable to store the highest timestamp
highscore=0
@mokanfar
mokanfar / User-keybindings.json
Last active May 17, 2020 01:26
sublime text settings json
[
{
"keys": [
"ctrl+b"
],
"command": "show_overlay",
"args": {
"overlay": "command_palette"
}
},
;Kiosk Keyboard with Skins
;
;Copyright (c) 2006-2015 Comfort Software Group
;ALL RIGHTS RESERVED
Height=152
Width=276
DefaultFitWidth=0
DefaultLockAspectRatio=1
DefaultMoveToBottom=0
DefaultCenterInfo=1
<VERSION>StrokeIt .9.4</VERSION>
<APP name="Default">
Close Window [C] {
Alt+F4 = keys, hotkey "[ALT_DOWN][F4][ALT_UP]"
}
Down {
gesture = Down
New Command = keys, hotkey "[CTRL_DOWN][END][CTRL_UP]"
}
@mokanfar
mokanfar / dl.sh
Last active August 10, 2019 02:15
/z/bin
#!/bin/env bash
#requirements wget
if [ -z "$1" ] && [ -z "$2" ]; then
echo "No url provided. exiting...";
elif [[ -z "$2" ]]; then
wget -r -l1 -H -t1 -nd -N -np -A jpg,jpeg,png,webm,gif -erobots=off $1;
rm *s.*
else
mkdir $2;
//find sku in json object list return arg[1] of that object
const filterIt = (sku, attr) => {
let arr = list.filter(function(asdf) {
return asdf.SKU == sku;
});
return arr[0][attr];
};
//ramda find without for each
R.find(R.propEq('a', 2))(xs)
/*
====================================
Small Screen - Tablet
====================================
*/
@media screen and (min-width: 768px) and (max-width: 991px) {
@mokanfar
mokanfar / All Attribute Codes Global.txt
Last active June 29, 2019 20:37
Magmi Magento Import Necessary Columns
name
short_description
sku
price
weight
color
notes
product_category_type
erp_sku
dimensions
@mokanfar
mokanfar / magento-code-snippets.md
Last active November 30, 2020 19:25 — forked from arosenhagen/magento-code-snippets.md
[magento] - code snippets

Magento Code Snippets

Programatically Save Product Manually

<?php
$copypasta = <<< EOC
SKU1
SKU2
EOC;
$skus = explode(PHP_EOL, $copypasta);