Skip to content

Instantly share code, notes, and snippets.

@clochix
clochix / attestation.sh
Created November 1, 2020 14:42
Code QR d’attestation de sortie
# Je doute que ça ait la moindre valeur en cas de contrôle par la maréchaussée mais ça crée un code QR au même format que celui produit par https://media.interieur.gouv.fr/deplacement-covid-19/
qrencode -o - "$(d=$(LANG=C date +"%d/%m/%Y a %H:%M") && echo -e "Cree le: $d;\n Nom: XXXX;\n Prenom: yyyy;\n Naissance: 01/01/1970 a ZZZZ;\n Adresse: 1, Rue Saint RMS 75020 PARIS;\n Sortie: $d;\n Motifs: $(dialog --no-items --menu Motif 0 0 0 travail achats sante famille handicap sport_animaux convocation missions enfants 3>&1 1>&2 2>&3)")" | tee attestation.png | feh -FZ -
@clochix
clochix / bankexport.sh
Last active May 29, 2021 16:43
Export data from Cozy Bank
#!/usr/bin/env bash
#########
#
# Export bank operations
#
# Syntax: bankexport claude.mycozy.cloud
#
# Requirements:
# - curl
@clochix
clochix / cozycli.sh
Created November 4, 2019 08:19
Sample bash script to interact with CozyCloud File API
#!/usr/bin/env bash
cozycli ()
(
server=''
token=''
tokenpath='token.json'
registrationpath='registration.json'
verbose='-s'
lastcode=''
@clochix
clochix / cozyexport.sh
Created July 16, 2019 09:39
CozyExport: sample script to export data from Cozy
#!/usr/bin/env bash
#########
#
# Export every documents from a datatype
#
# Syntax: cozyexport claude.mycozy.cloud io.cozy.contacts
#
########
@clochix
clochix / disable2fa.js
Created August 1, 2016 14:36
Manually disable 2FA on a Cozy server
//
// Disable 2FA
//
var exit, request, runCmd;
request = require('request-json');
client = request.createClient('http://localhost:9103');
exit = function(code) {
return setTimeout((function() {
@clochix
clochix / cf.sh
Last active June 28, 2016 08:03
Bash functions for dealing with files on CozyCloud
function cf {
case "$1" in
list)
cozy-monitor curlcouch --pretty _design/file/_view/byfullpath | jq -r '.rows[].value | .path+"/"+.name+" "+._id' | sort
;;
get)
name=$(cozy-monitor curlcouch $2 | jq -r '.name')
curl -s -o $name $(sed -n '1,1p' /etc/cozy/couchdb.login):$(sed -n '2,1p' /etc/cozy/couchdb.login)@127.0.0.1:5984/cozy/$(cozy-monitor curlcouch $2 | jq '.binary.file.id')/file
echo $name
;;
@clochix
clochix / cozy.opml
Created November 30, 2015 14:06
Cozy OPML
<?xml version="1.0" encoding="ISO-8859-1"?>
<opml version="2.0">
<head>
<title>Cozy.opml</title>
<ownerName>CozyCloud</ownerName>
</head>
<body>
<outline title="Cozy">
<outline text="americano" description="Wrapper for Express that makes its configuration clean and easy." xmlUrl="https://libraries.io/npm/americano/versions.atom" title="americano" type="rss" />
<outline text="americano-cozy" description="Americano helpers to build Cozy applications faster" xmlUrl="https://libraries.io/npm/americano-cozy/versions.atom" title="americano-cozy" type="rss" />
@clochix
clochix / gist:4b8576b1eac17b45d012
Created November 3, 2015 12:44
Using Debian alternative system to switch between versions of Node.js
To switch easily between Node versions on Debian, instead of tools like [nvm](https://github.com/creationix/nvm), you can just use [Debian's native alternatives system](http://www.debian-administration.org/article/91/Using_the_Debian_alternatives_system).
(the following commands require root privilege)
- download and install the node executables under /usr/local/bin/nodes/…
- add this binaries to the alternative system:
update-alternatives --install /usr/bin/node node /usr/bin/nodejs 100
update-alternatives --install /usr/bin/node node /usr/local/bin/nodes/0.10.38/nodejs 50
- to switch between versions, just call `update-alternatives --config node`
@clochix
clochix / keybase.md
Created October 23, 2014 12:01
Keybase validation

Keybase proof

I hereby claim:

  • I am clochix on github.
  • I am clochix (https://keybase.io/clochix) on keybase.
  • I have a public key whose fingerprint is FE70 1DEC 5060 0716 D631 7AE6 96DD 4B5C 2060 838F

To claim this, I am signing this object:

@clochix
clochix / encode.html
Created July 16, 2014 20:06
Encode and decode mails
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Chiffre</title>
<link rel="icon" type="image/png" href="" />
<style type="text/css">
html, body {
height: 100%;