Skip to content

Instantly share code, notes, and snippets.

@Korayem
Korayem / cleant_html_and_convert_to_html.js
Last active April 30, 2024 19:47
Javascript only solution to sanitize HTML content then convert it to markdown. All solutions were npm packages with tons of dependencies and I needed a simple solution to run in the browser client side
/*
Generetad by GPT-4-turbo
------------------------------------------------------------------------------------------------------------
Prompt 1:
let’s create a function that cleans up an input html
1. Remove all scripts tags
2. Remove all iframes tags
3. Remove `<head>`
4. Remove CSS style tags
@Korayem
Korayem / patch_apk_for_sniffing.md
Created August 9, 2021 10:10 — forked from unoexperto/patch_apk_for_sniffing.md
How to patch Android app to sniff its HTTPS traffic with self-signed certificate

How to patch Android app to sniff its HTTPS traffic with self-signed certificate

  • Download apktool from https://ibotpeaches.github.io/Apktool/
  • Unpack apk file: java -jar /home/expert/work/tools/apktool.jar d [email protected]
  • Modify AndroidManifest.xml by adding android:networkSecurityConfig="@xml/network_security_config" attribute to application element.
  • Create file /res/xml/network_security_config.xml with following content:
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <base-config>
@Korayem
Korayem / fix_exfat_drive.md
Created August 7, 2021 20:22 — forked from scottopell/fix_exfat_drive.md
Fix corrupted exFAT disk macOS/OSX

exFAT support on macOS seems to have some bugs because my external drives with exFAT formatting will randomly get corrupted.

Disk Utility is unable to repair this at first, but the fix is this:

  1. Use diskutil list to find the right drive id.
  2. You want the id under the IDENTIFIER column, it should look like disk1s1
  3. Run sudo fsck_exfat -d <id from above>. eg sudo fsck_exfat -d disk1s3
  4. -d is debug so you'll see all your files output as they're processed.
  5. Answer YES if it gives you the prompt Main boot region needs to be updated. Yes/No?
@Korayem
Korayem / searchGitBranchWithJiraIssue.sh
Last active March 27, 2019 12:29
search git commit message using jira issue key and return a list of branches that contain them, specifically: dev/staging/master branches to make sure they got merged properly
#!/bin/bash
# @korayem - 2019
# search git commit message using jira issue key and return a list of branches that contain them, specifically: dev/staging/master branches to make sure they got merged properly
# ./searchgit.sh PEG-1234 PEG-3214
# Returns something like this:
# PEG-1973 69df0fc238742acc099db85d799e05d7356b3f9b
# origin/HEAD -> origin/master
# origin/dev
# origin/master
@Korayem
Korayem / migrate_rubocop_style_to_layout.rb
Last active January 10, 2019 11:30 — forked from wojtha/migrate_rubocop_style_to_layout.rb
Ruby script to migrate Rubocop settings from Style to Layout
# source: https://gist.github.com/wojtha/f97f45a6a09f14a58e5721fb178f2d3f
# Fixes complains such as:
# .rubocop.yml: Style/IndentationConsistency has the wrong namespace - should be Layout
# .rubocop.yml: Style/IndentationWidth has the wrong namespace - should be Layout
# .rubocop.yml: Style/DotPosition has the wrong namespace - should be Layout
layouts = %w[
AccessModifierIndentation
AlignArray
AlignHash
XAML
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="MobileApp.MyPage" xmlns:hsl="clr-namespace:mcpNetwork.Components.Forms;assembly=mcpnetwork.horizontalScrollLayout">
<ContentPage.Content>
<StackLayout Padding="0" Spacing="0">
<hsl:HorizontalScrollLayout x:Name="hscroll" HeightRequest="80" MultiSelection="false" ItemSelected="OnItemSelected">
<hsl:HorizontalScrollLayout.ItemTemplate>
<DataTemplate>
<ViewCell>
@Korayem
Korayem / Dropbox Undelete with jQuery.js
Created June 4, 2012 16:12
undelete dropbox files - method 2
//From event page
//Example https://www.dropbox.com/events/15112434/168381077
var filesToRestore = [];
jQuery('img.link-img').each(function(){filesToRestore.push(decodeURIComponent(this.title));})
new Ajax.DBRequest("/cmd/restore", {
parameters: {
files: filesToRestore
@Korayem
Korayem / update.bat
Created June 4, 2012 16:09
Easily upgrade nuget.exe in ".nugets" folder
nuget update -self
@Korayem
Korayem / TrackEventsInGoogleAnalyticsAttribute.cs
Created June 4, 2012 15:58
A cool ActionFilter that when dropped over any controller or action, you got yourself google analytics event tracking! By default we assign controller name as category, and action name as the action. In the label we drop the user identity in case he/she i
using System.Configuration;
using System.Web.Mvc;
using GoogleAnalyticsTracker;
using SocialFruits.Domain;
using SocialFruits.Domain.Entities;
namespace SocialFruits.Extensions.Attributes
{
public class TrackEventsInGoogleAnalyticsAttribute : ActionFilterAttribute
{