Skip to content

Instantly share code, notes, and snippets.

View geekwolverine's full-sized avatar

Blaze geekwolverine

View GitHub Profile

Do not use forEach with async-await

TLDR: Use for...of instead of forEach in asynchronous code.

The problem

Array.prototype.forEach is not designed for asynchronous code. (It was not suitable for promises, and it is not suitable for async-await.)

For example, the following forEach loop might not do what it appears to do:

@geekwolverine
geekwolverine / opendir.md
Created June 1, 2023 07:28 — forked from jermspeaks/opendir.md
Manually Searching OpenDirectories on Google

Manually Searching OpenDirectories on Google

For videos/movies/tvshows :

intext:\"Search Term\" intitle:\"index.of\" +(wmv|mpg|avi|mp4|mkv|mov) -inurl:(jsp|pl|php|html|aspx|htm|cf|shtml)

Images :

@geekwolverine
geekwolverine / opendir.md
Created June 1, 2023 07:28 — forked from jermspeaks/opendir.md
Manually Searching OpenDirectories on Google

Manually Searching OpenDirectories on Google

For videos/movies/tvshows :

intext:\"Search Term\" intitle:\"index.of\" +(wmv|mpg|avi|mp4|mkv|mov) -inurl:(jsp|pl|php|html|aspx|htm|cf|shtml)

Images :

@geekwolverine
geekwolverine / spam-domains
Created May 27, 2023 07:02 — forked from brandedoutcast/spam-domains
Spam domains that plague my email
jmails.info
sacustomerdelight.co.in
extrobuzzapp.com
ixigo.info
offer4uhub.com
netecart.com
101coupon.in
freedealcode.in
bankmarket.in
hotoffers.co.in
@geekwolverine
geekwolverine / System Design.md
Created May 20, 2023 07:32 — forked from vasanthk/System Design.md
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?

Recovering deleted files in Ubuntu with ext4 filesystem

Recently, I deleted some files by mistake in a Ubuntu machine with an ext4 fs. These notes document the steps I took to get them back.

Important

  • this procedure assumes that the partition that contained the deleted files is different from the root partition, as that was the scenario with which I had to deal (deleted files were in my home dir). The procedure needs that the partition that contained the files is unmounted, so if the deleted files were in the root partition, the process would be a bit different (e.g. storing the fs journal in a USB stick, using a live CD/USB to boot and issue the commands, etc.)
  • if something is not clear, you need more information, etc. check the sources below

With that out the way, let's begin.

@geekwolverine
geekwolverine / gist:ebb441680008cc0c250a2862543d9305
Created April 20, 2023 15:01 — forked from bonyiii/gist:1471379
restore overwritten files linux
http://www.ehow.com/how_7517984_restore-overwritten-file-linux.html
Assess which partition on your computer you need to access to recover the files.
2
Unmount the directory using the "unmount" command in the interface. This will help prevent damaging the file you are trying to recover.
3
Type "debugfs" in the command line interface (all typing without quotation marks) and include the file system where the overwritten file is into the command. For example, typing "debugfs usr/personal" will bring up your personal directory. Hit "Enter" after typing the command.
4
@geekwolverine
geekwolverine / how_to_setup_hotspot.md
Created March 31, 2023 22:20 — forked from Semant1ka/how_to_setup_hotspot.md
How to set up WiFi hotspot and troubleshoot WiFi problems on Debian

There are a few decent tutorials on how to setup hotspot on Linux, which I will share below, but this tutorial will focus on adversities that you without doubt will face while setting up your AP.

For AP setup we will need:

  • Hostapd utility
  • Some dhcp utility
  • A bit of patience (that was for my case)

How do I know that my WiFi adapter supports AP mode?

In terminal type sudo iw list this command will show info about your wifi interfaces. Look for Supported interface entry, if AP is in it, that means your Wifi devices support hotspot mode.

@geekwolverine
geekwolverine / CreateProductController.php
Created March 21, 2023 21:48 — forked from cagartner/CreateProductController.php
Creating product programatically on Bagisto Laravel
<?php
// File: app/Http/Controllers/CreateProductController.php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Webkul\Attribute\Models\Attribute;
use Webkul\Attribute\Models\AttributeOption;
use Webkul\Attribute\Repositories\AttributeFamilyRepository;
use Webkul\Product\Repositories\ProductRepository;
@geekwolverine
geekwolverine / functions.php
Created March 7, 2023 18:50 — forked from paaljoachim/functions.php
WooCommerce: Adding multiple custom fields to the order notes area in the checkout page
/* 1. Adds a custom field. NB. I am using some Norwegian words in the below text.
* 2. Then adds a validate error message if person does not fill out the field.
* 3. Then adds the custom field to the order page.
https://businessbloomer.com/woocommerce-add-custom-checkout-field-php/
https://businessbloomer.com/woocommerce-add-shipping-phone-checkout/
https://docs.woocommerce.com/document/tutorial-customising-checkout-fields-using-actions-and-filters/#section-6
*/
add_action( 'woocommerce_before_order_notes', 'my_custom_checkout_field' );
function my_custom_checkout_field( $checkout ) {