Skip to content

Instantly share code, notes, and snippets.

% curl -v \
-F comment='kommentar' \
-F filename=filnavn.pdf \
-F attachToPayment=false \
-F attachToSale=true \
-F file=@vedlegg.pdf \
-H "Authorization: Bearer <token>" \
https://api.fiken.no/api/v2/companies/<companyname>/sales/<salesid>/attachments
> POST /api/v2/companies/fiken-demo-god-og-tydelig-musikk-as/sales/1029625303/attachments HTTP/1.1
@steingrd
steingrd / axios-fiken-upload.js
Created March 19, 2020 17:44
Fiken APIv2 - upload file with axios
import axios from "axios";
import FormData from "form-data";
import fs from "fs";
const apiToken = "..."
const url = "...";
const formData = new FormData();
formData.append("file", fs.createReadStream(__dirname + '/test.pdf'));
formData.append("filename", "test.pdf");
@steingrd
steingrd / keybase.md
Created October 5, 2014 18:34
keybase.md

Keybase proof

I hereby claim:

  • I am steingrd on github.
  • I am steingrd (https://keybase.io/steingrd) on keybase.
  • I have a public key whose fingerprint is 1828 80D9 DBA9 4CB0 5DF6 9DD9 AB3E 253F 20D0 530A

To claim this, I am signing this object:

@steingrd
steingrd / gist:3658707
Created September 6, 2012 17:18
Script for downloading Radioresepsjonen podcasts
#!/bin/bash
wget http://podkast.nrk.no/program/radioresepsjonen.rss -O radioresepsjonen.rss
grep enclosure radioresepsjonen.rss | cut -d '"' -f2 | cut -d '?' -f1 > urls.txt
for line in $(cat urls.txt); do
fname=$(echo $line | cut -d '/' -f6)
if [ ! -e $fname ]; then
wget $line
@steingrd
steingrd / gist:1992567
Created March 7, 2012 11:12
Open Explorer from Cygwin terminal
function e {
TMP_P="$*"
if [[ -z "$*" ]]
then TMP_P=`pwd`
fi
explorer "`cygpath -w \"$TMP_P\"`"
}
@steingrd
steingrd / gist:580931
Created September 15, 2010 15:45
Check setup.py config by installing a package to a temp virtualenv
#!/bin/bash
function check_setuppy_exists() {
if [ ! -e setup.py ]; then
echo "missing setup.py, aborting";
exit 1;
fi
}
function create_virtualenv() {
@steingrd
steingrd / gist:408569
Created May 21, 2010 07:12
Find large objects in a Git repo
#!/bin/sh
#
# From http://mid.gmane.org/20090710114316.GA6880@atjola.homenet
#
usage() {
echo "usage: `basename $0` [<limit>]"
exit 1
}
@steingrd
steingrd / gist:376754
Created April 23, 2010 16:22
Display Git branch in PS1
function parse_git_branch {
local BRANCH=`\git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'`
if [ ! -z "${BRANCH}" ]
then
local STATUS=`\git status --porcelain 2> /dev/null`
if [ ! -z "${STATUS}" ]
then
STATUS="*"
fi