Skip to content

Instantly share code, notes, and snippets.

View HelgeSverre's full-sized avatar
🧠
LLMs gonna take our jewrbs.

Helge Sverre HelgeSverre

🧠
LLMs gonna take our jewrbs.
View GitHub Profile
@HelgeSverre
HelgeSverre / craft-save-plugin-settings.php
Last active April 4, 2018 11:40
How to update a setting attribute for a CraftCMS plguin
<?php
$plugin = craft()->plugins->getPlugin('pluginHandle');
// This does NOT work.
$plugin->getSettings()->setAttribute("attributename", "attribute value");
// Do this instead!
@HelgeSverre
HelgeSverre / kikUserEnum.py
Created January 5, 2016 12:03
KIK Username Enumeration Script
#!/usr/bin/env python
# KIK.me Username Enumerator
import os
import sys
import requests
def main():
base_url = "http://kik.me/"
@HelgeSverre
HelgeSverre / main.dart
Created November 2, 2019 15:00
utf8 decode error
import 'dart:convert';
import 'dart:typed_data';
void main() {
var name = "A string containing ø";
var bytes = Uint8List.fromList(name.codeUnits);
var decoded = json.decode(utf8.decode(bytes));
print(decoded);
@HelgeSverre
HelgeSverre / mysql-sorting-norwegian.md
Last active March 21, 2020 10:28
How to make sorting work properly for Norwegian characters in MySQL - Æ Ø Å

If you have an issue with "order by " not working correctly with norwegian characters eg:

table: names

  • Andreas
  • Betty
  • Øystein
  • Ole martin
  • Ylvis
  • Åse Hansen
@HelgeSverre
HelgeSverre / vue-moment-workarounds.md
Last active July 30, 2020 17:16
How to fix vue-moment locale issues and reactivity in Vue

Problem 1

If you are dynamically changing the locale of your vue application and setting the locale of moment js to that locale, your formatted dates will not be re-rendered, this is due to moments locale not being reactive (vue doesnt know that moment's internal state changed)

Solution

We need to create a custom renderless component that wraps the functionality we want, and whenever

@HelgeSverre
HelgeSverre / brreg.php
Created March 2, 2022 12:20
Laravel Brønnøysundregistrene - Brreg
<?php
use Illuminate\Support\Facades\Http;
class Brreg
{
public function getByVatId($vatId)
{
@HelgeSverre
HelgeSverre / fix.sh
Created March 11, 2022 14:39
Docker for Desktop on Mac out of space
# Wipe the entire "VM" and rebuild everything
rm ~/Library/Containers/com.docker.docker/Data/vms/0/data/Docker.raw
@HelgeSverre
HelgeSverre / the-only-google-result.txt
Created March 30, 2022 19:22
CustomerInvoiceValidationTotalAmountNotAllowedToBeZeroOrMore - explained
When creating a credit note via the eAccounting API v2 you have to make
the quantity a negative number or else you will get this error:
CustomerInvoiceValidationTotalAmountNotAllowedToBeZeroOrMore
@HelgeSverre
HelgeSverre / AppServiceProvider.php
Created April 30, 2023 09:41
Allow relative links in FilamentPHP's RichEditor Field.
<?php
namespace App\Providers;
use Filament\Facades\Filament;
use Illuminate\Contracts\View\View;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
@HelgeSverre
HelgeSverre / OCR.txt
Created May 15, 2023 23:40
Receipt scanning with GPT-3 incl prompt
// Tokens: 371
// Characters: 833
BUNNPRIS BUNNPRIS LINDVIK Butikkdrift Akgeyik AS Foretaksregisteret ORG. NR. 813 499 002 MVA BEKKEVEIEN 14 5096. BERGEN TLF:55 29 78 67 SALGSKVITTERING Butikknr. 704 Butikknavn BUNNPRIS LINDVIK Kvitt. 1506131 23.02.2023 18:08:44 Operator 70445 Term. nr 7042 Herav mva 20.52 Ant. varer 5 *NIVEA ROLL-ON DRY COMFORT 50ML 20.93 *BLIW HANDSAPE MIKS 300ML 27.90 #MILK CHOCOLATE COOKIE AUNT MABEL 44.90 #KIMS POTETGULL PEPPER PUNCH 200G 32.90 3.00 *BAREPOSER TOTALT A BETALE 129.63 129.63 BANK MVA% Grunnlag MVA Totalt 41.46 10.37 51.83 *25.00 67.65 10.15 77.80 #15.00 Bax: 10309778-627085 23/02/2023 18:08 Overf.:400 BankAxent Contactless *******8867-7 AID: D5780000021010 Ref.: 999821 008352 KC1 TVR:8000008000 Resp.: 00 NOK KJOP 129,63 GODKJENT TAKK FOR HANDELEN Apent 09-22, lor 09-20 Besok OSS pa www.bunnpris.no B70470422302230150613