Skip to content

Instantly share code, notes, and snippets.

View taktran's full-sized avatar

Tak Tran taktran

View GitHub Profile
@taktran
taktran / README.md
Last active April 18, 2024 19:08
Extract Chat GPT Logs

Extract Chat GPT Logs

Made this to help me extract Chat GPT logs, for future reference.

Chat GPT did help in helping me write this :)

To use

@taktran
taktran / custom-fonts.md
Last active April 27, 2023 17:15
Custom fonts

How to add custom fonts to a webpage:

  1. Generate web fonts for every browser eg, use https://www.fontsquirrel.com/tools/webfont-generator or https://transfonter.org/

  2. Add fonts to css/fonts folder or equivalent

  3. Look inside downloaded font files for a stylesheet.css or equivalent and copy the @font-face, while adjusting the file paths to match the location of the font folder

    @font-face {
      font-family: "Some font";
      src: url("css/fonts/some-font.eot");
    

src: url("css/fonts/some-font.woff") format("woff"),

@taktran
taktran / machine.js
Created July 24, 2022 11:13
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@taktran
taktran / rpi-led-notes.md
Last active July 22, 2022 14:20
Controlling Raspberry Pi 2 LEDs

Commands for controlling the Raspberry Pi 2 LEDs.

See rpi-leds for a node module that does this.

Power (PWR) LED

  • OK (ACT) LED = led0
  • Power (PWR) LED = led1

Allow access

@taktran
taktran / machine.js
Last active June 26, 2022 17:43
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@taktran
taktran / sinatra_cheatsheet.md
Created December 7, 2011 15:45
Sinatra cheatsheet

Useful commands

last_response
    .body

last_request
    .path
    .url
    .session

.cookies

@taktran
taktran / machine.js
Last active March 29, 2021 12:10
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@taktran
taktran / machine.js
Last active July 17, 2020 12:07
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@taktran
taktran / machine.js
Last active July 17, 2020 12:01
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@taktran
taktran / mongo-utils.js
Last active June 10, 2020 08:58
Mongo db utils
const MongoClient = require('mongodb').MongoClient;
const assert = require('assert');
exports.findInCollection = ({ db, collectionName }) => query => {
assert.notEqual(db, undefined);
const collection = db.collection(collectionName);
return collection.find(query).toArray();
};