Skip to content

Instantly share code, notes, and snippets.

@perfaram
perfaram / index.js
Created March 15, 2024 07:44
dump product descriptions for all products in the "pasta" category sold at Migros (Switzerland)
import pkg from 'migros-api-wrapper';
const { MigrosAPI, ILoginCookies } = pkg;
import fs from 'fs';
main();
async function main() {
// Search for products matching a certain string.
const guestInfo = await MigrosAPI.account.oauth2.getGuestToken();
const responseCategoryList = await MigrosAPI.products.productSearch.category({
@perfaram
perfaram / k3_keys.html
Created October 15, 2017 13:44
A backup of parhelia.ch's SMC key informations and structs declarations.
<html><head>
<body>
<center><h1>SMC Keys</h1></center>
<center><h2>K3 Version: 1.30f1
</h2></center>
<p>
<table cellpadding="2" cellspacing="2" border="1" width="100%">
<tr>
<th align=middle>KEY</th>
<th align=middle>TYPE</th>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>T*</key>
<string>Temperature</string>
<key>V*</key>
<string>Voltage</string>
<key>I* (upper-case i, not lower-case L)</key>
<string>Intensity (current)</string>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>#KEY</key>
<string>ui32</string>
<key>+LKS</key>
<string>flag</string>
<key>AL!</key>
<string>ui8</string>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>#KEY</key>
<string>Total key count</string>
<key>+LKS</key>
<string>Returns 3 bit value, where each bit represents one of the three lock bit regions.</string>
<key>AL!</key>
<string>ALS variables overriding</string>
@perfaram
perfaram / encode_ascii_as_dna.py
Last active July 19, 2017 17:46
Encoding ASCII text as DNA (quaternary base)
def to_base(n, bse):
digs = "0123456789abcdefghijklmnopqrstuvwxyz"
tmp = []
while n:
n, i = divmod(n, bse)
tmp.append(digs[i])
return "".join(tmp[::-1])
def chng_frm_base(s, frm_bse, to_bse):
if to_bse < 2 or to_bse > 36 or frm_bse < 2 or frm_bse > 36:
import UIKit
public class Vertex {
var key: String?
var neighbors: Array<Edge>
init() {
self.neighbors = Array<Edge>()
}
}
@perfaram
perfaram / Siriproxy_iTunes_play_track.rb
Last active December 24, 2015 06:09
Function which listen for a Siri command, catch the name of the track, then play it in iTunes.Part of a Siriproxy Plugin. French speaking required.
listen_for /Mac play (.*)/i do |play|
#Only for french speaking !!!
replacements = [ ["My", "Me"], ["col", "Call"], ["radiant", "Radian"] ]
replacements.each {|replacement| play.gsub!(replacement[0], replacement[1])}
#Only for french speaking !!! [End]
itunescheck = system("osascript -e 'if application \"iTunes\" is running then return 1'");
if play==nil then
say "Viva la musica !", spoken: "Vivaa la mousiica !"
@perfaram
perfaram / cltools.sh
Last active December 7, 2015 16:22 — forked from jellybeansoup/cltools.sh
#!/bin/sh
##
# Install autoconf, automake and libtool smoothly on Mac OS X.
# Newer versions of these libraries are available and may work better on OS X
#
# This script is originally from http://jsdelfino.blogspot.com.au/2012/08/autoconf-and-automake-on-mac-os-x.html
#
export build=~/devtools # or wherever you'd like to build
@perfaram
perfaram / semiprivate.md
Created November 21, 2015 19:57 — forked from tarcieri/semiprivate.md
Ed25519-based semi-private keys

Semiprivate Keys

Semi-private keys are an expansion of the traditional idea of asymmetric keys, which have a public/private keypair, to N keys which can each represent a different capability level. In the degenerate case, a semi-private key system has 3 different types of keys. These are, to use the Tahoe terminology:

  • writecap: can publish new ciphertexts
  • readcap: can read/authenticate ciphertexts