Skip to content

Instantly share code, notes, and snippets.

View Trippnology's full-sized avatar

Trippnology Trippnology

View GitHub Profile
@Trippnology
Trippnology / up.sh
Created September 6, 2024 17:08
Walk up the directory tree
# Walk up the directory tree
# Pass in a number to walk up that many levels
function up() {
COUNTER=${1-1}
while [[ $COUNTER -gt 0 ]]
do
UP="${UP}../"
let COUNTER-=1
done
echo "cd $UP"
Act as an interpreter between natural language and shell commands. The user will provide a natural language request, and you will respond with the shell command to accomplish this task. Do not include any other text or explanation in your response.
Example responses:
User: delete the file somefile.txt
Assistant: rm somefile.txt
User: copy the file somefile.txt to someotherfile.txt
Assistant: cp somefile.txt someotherfile.txt
@Trippnology
Trippnology / chunking-regex.ts
Created August 15, 2024 10:20 — forked from hanxiao/testRegex.js
Use regex to do chunking by using all semantic cues
// Used in https://jina.ai/tokenizer (Aug. 14th version)
// Define variables for magic numbers
const MAX_HEADING_LENGTH = 6;
const MAX_HEADING_CONTENT_LENGTH = 200;
const MAX_HEADING_UNDERLINE_LENGTH = 200;
const MAX_HTML_HEADING_ATTRIBUTES_LENGTH = 100;
const MAX_LIST_ITEM_LENGTH = 200;
const MAX_NESTED_LIST_ITEMS = 5;
const MAX_LIST_INDENT_SPACES = 7;
const MAX_BLOCKQUOTE_LINE_LENGTH = 200;
@Trippnology
Trippnology / logs
Created July 4, 2024 20:30
BPQ management scripts
journalctl -ru linbpq
@Trippnology
Trippnology / esm-package.md
Created May 4, 2023 20:09 — forked from sindresorhus/esm-package.md
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@Trippnology
Trippnology / 2022-11-06_verified_ids.txt
Created May 4, 2023 16:44 — forked from igorbrigadir/2022-11-06_verified_ids.txt
All 423,502 @verified follows from 2022-11-06, which is all the twitter user IDs that were verified before Twitter's new Blue Verification.
This file has been truncated, but you can view the full file.
1040206865387409408
1378815453510914056
1124983612389171200
1250006106736398336
1151791608494473219
832501002200838144
752487114621718528
968788335207632896
968063439624052736
158686789
@Trippnology
Trippnology / legacy-verified.csv
Created May 4, 2023 16:42 — forked from travisbrown/legacy-verified.csv
Twitter accounts with legacy verification on 4 April 2023 (see https://twitter.com/travisbrown/status/1643229276278235136)
We can't make this file beautiful and searchable because it's too large.
Twitter ID, Screen name, Followers
12,jack,6526006
13,biz,2608289
20,ev,1679155
57,SarahM,17448
59,Tim535353,9340
76,marciadorsey,19501
224,davepell,57523
291,goldman,916937
295,joshk,149086
<!-- See: https://www.filamentgroup.com/lab/load-css-simpler/ -->
<link rel="stylesheet" href="/path/to/my.css" media="print" onload="this.media='all'">
@Trippnology
Trippnology / compound-interest.js
Last active July 19, 2018 01:18 — forked from actuallymentor/compound-interest.js
A simple script to calculate compound interest
// Input it initial amount
// Interest as a number, e.g. 5% is 1.05 on a yearly basis
// Length as number of years
// Name of this calculation
// Addition determines whether the input variable is one time or a yearly contribution
function compound( input, interest, length, name, addition ) {
var accumulated = input
for ( i=0; i < length; i++ ) {
accumulated *= interest
if ( addition ){
@Trippnology
Trippnology / equalise-height.js
Created April 3, 2018 18:23
jQuery: Equalise height of set of elements
function equalizeHeight(selector) {
var maxheight = 0;
$(selector).each(function(){
var height = parseInt($(this).css('height'));
if (height > maxheight ) {
maxheight = height;
}
});
$(selector).css('height', maxheight);
}