Skip to content

Instantly share code, notes, and snippets.

View M-Dahab's full-sized avatar
🔥
Coding..

Mohammad Dahab M-Dahab

🔥
Coding..
View GitHub Profile
@obahareth
obahareth / extract_enum_mappings.md
Last active November 30, 2021 11:59
Extract Ruby on Rails enum values into a dictionary (represented by markdown tables).

README

Sometimes you have members from your data team who are looking at the database and have no idea what the enum integer values mean. This snippet of code helps to extract the readable names for those integers into markdown tables to help out your data team.

There are alternative approaches by using string enums via gems, or database enums, but this was made for an environment where those weren't an option (legacy enums, and no database enums available).

You could also put this into a Rake task and publish it into a wiki.

Usage

@PraneshASP
PraneshASP / createWallet.js
Last active March 12, 2024 11:51
Create a bitcoin wallet with this simple script.
//Import dependencies
const bip32 = require('bip32')
const bip39 = require('bip39')
const bitcoin = require('bitcoinjs-lib')
//Define the network
const network = bitcoin.networks.bitcoin //use networks.testnet for testnet
// Derivation path
const path = `m/49'/0'/0'/0` // Use m/49'/1'/0'/0 for testnet
@KonnorRogers
KonnorRogers / environment.js
Last active October 3, 2022 17:25
ESBuild with Webpacker < 6 in Rails. Bye Babel <3
// DONT FORGET TO `yarn add esbuild-loader` !!!
// config/webpacker/environment.js
const { environment } = require('@rails/webpacker')
const { ESBuildPlugin } = require('esbuild-loader')
const esBuildUse = [
{
loader: require.resolve('esbuild-loader'),
// What you want to compile to, in this case, ES7
@rampfox
rampfox / Chromium-at-startup.md
Last active June 1, 2024 03:55
How to open Chromium in full screen at startup on the Raspberry Pi

(debian 10 buster)

First, it seems that ~/.config/lxsession/LXDE-pi/autostart does not exist by default.

  1. copy the autostart
cp /etc/xdg/lxsession/LXDE-pi/autostart ~/.config/lxsession/LXDE-pi/
@elevenchars
elevenchars / fridanotes.md
Last active June 7, 2024 11:14
My notes on injecting a frida gadget into an apk
function interceptNetworkRequests(ee) {
const open = XMLHttpRequest.prototype.open;
const send = XMLHttpRequest.prototype.send;
const isRegularXHR = open.toString().indexOf('native code') !== -1;
// don't hijack if already hijacked - this will mess up with frameworks like Angular with zones
// we work if we load first there which we can.
if (isRegularXHR) {
@tanaikech
tanaikech / submit.md
Last active April 30, 2024 19:49
Adding Query Parameters to URL using Google Apps Script

Adding Query Parameters to URL using Google Apps Script

Updated on February 5, 2024

This is for adding the query parameters to the URL. These scripts can be also used for Javascript. When I created an endpoint with some query parameters, I had used the scripts of various patterns every time. Today, I prepared this sample script to unify them. If this is also useful for you, I'm glad.

Sample script (With V8 runtime):

String.prototype.addQuery = function (obj) {
@bradtraversy
bradtraversy / myscript.sh
Last active June 13, 2024 02:51
Basic Shell Scripting
#! /bin/bash
# ECHO COMMAND
# echo Hello World!
# VARIABLES
# Uppercase by convention
# Letters, numbers, underscores
NAME="Bob"
# echo "My name is $NAME"
@zthxxx
zthxxx / Activate Office 2019 for macOS VoL.md
Last active June 13, 2024 08:06
crack activate Office on mac with license file
@marteinn
marteinn / instructions.md
Last active November 10, 2022 14:18
This is a Phoenix + React-Create-App integration with very small footprint
  1. Begin with scaffolding a create-react-app, then update your package.json build script (replace DIR_TO_PHX_APP with the path to your phoenix app)
"build": "react-scripts build && rm -rf DIR_TO_PHX_APP/priv/static/build && mv build DIR_TO_PHX_APP/priv/static/build",

This will move your prod build files to DIR_TO_PHX_APP/priv/static/build on build

  1. Run npm run build