Skip to content

Instantly share code, notes, and snippets.

@hanxiao
hanxiao / testRegex.js
Last active October 17, 2024 17:30
Regex for chunking by using all semantic cues
// Updated: Aug. 20, 2024
// Run: node testRegex.js whatever.txt
// Live demo: https://jina.ai/tokenizer
// LICENSE: Apache-2.0 (https://www.apache.org/licenses/LICENSE-2.0)
// COPYRIGHT: Jina AI
const fs = require('fs');
const util = require('util');
// Define variables for magic numbers
const MAX_HEADING_LENGTH = 7;
@lukasgabriel
lukasgabriel / README.md
Last active September 7, 2024 10:04
ChatGPT Raindrop.io Plugin/GPT

README

This is the metadata and OpenAPI spec I created for a custom ChatGPT plugin (or GPT, as OpenAI calls them) that can search your Raindrop.io bookmark library for you. It is tested and working, albeit with mixed results when dealing with large amounts of tags and collections. With further tuning of the system prompt and OpenAPI spec, it could be vastly improved.

Here is the unpublished plugin: https://chat.openai.com/g/g-uNdVJh9vu-raindrop-io-search-assistant
I will update it if I ever get the OAuth to work, until then, it won't work unfortunately.

I decided against publishing on the 'GPT Store' because I could not get the OAuth login to work despite following Raindrop.io and OpenAI documentation closely. Also, such an integration should probably be provided by the Raindrop.io devs anyways.

@unoexperto
unoexperto / patch_apk_for_sniffing.md
Last active September 29, 2024 16:13
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 net.flixster.android-9.1.3@APK4Fun.com.apk
  • 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>
@davidfurlong
davidfurlong / JSON.stringify-replacer-sort-keys.js
Last active September 30, 2024 15:09
JSON.stringify replacer function for having object keys sorted in output (supports deeply nested objects)
// Spec http://www.ecma-international.org/ecma-262/6.0/#sec-json.stringify
const replacer = (key, value) =>
value instanceof Object && !(value instanceof Array) ?
Object.keys(value)
.sort()
.reduce((sorted, key) => {
sorted[key] = value[key];
return sorted
}, {}) :
value;
@scottopell
scottopell / fix_exfat_drive.md
Last active October 13, 2024 03:17
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?
@weslleih
weslleih / date.extensions.ts
Last active November 11, 2023 08:00
Extend the TypeScript Date Object with some useful methods
export {}
declare global {
interface Date {
addDays(days: number, useThis?: boolean): Date;
isToday(): boolean;
clone(): Date;
isAnotherMonth(date: Date): boolean;
isWeekend(): boolean;
isSameDate(date: Date): boolean;
@twolfson
twolfson / README.md
Last active June 10, 2023 08:23
timever, time based versioning

timever

time-ver

Time based versioning

Synopsis

For versioning published releases of websites/services, we use a datetime based string to denote different releases

DATE.TIME.SUBTIME

// Zero-Clause BSD (more permissive than MIT, doesn't require copyright notice)
//
// Permission to use, copy, modify, and/or distribute this software for any purpose
// with or without fee is hereby granted.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
// OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
@DarkLotus
DarkLotus / No animation
Created August 22, 2014 09:00
Remove default animation from Xamarin forms navigation renderer
/*
Shared implementation, use in place of NavigationPage
*/
using Xamarin.Forms;
namespace LakesEntrance
{
public class NoAnimationNavigationPage : NavigationPage
{
public NoAnimationNavigationPage(Page startupPage) :base(startupPage)
@jimbuck
jimbuck / InvalidModelException.cs
Created August 11, 2014 17:57
C# Validation Helper
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Runtime.Serialization;
namespace JimmyBoh.Common.Exceptions
{
public class InvalidModelException : Exception
{