Skip to content

Instantly share code, notes, and snippets.

View mrnovalles's full-sized avatar
🚲

Mariano Vallés mrnovalles

🚲
View GitHub Profile
@mrnovalles
mrnovalles / itermwidget.js
Created November 4, 2022 13:41
An extension of the popular iterm widget for Scriptable to include energy costs in Spain
// Variables used by Scriptable.
// These must be at the very top of the file. Do not edit.
// icon-color: deep-gray; icon-glyph: magic;
// Change these to your usernames!
const user = "mrnovalles";
// API PARAMETERS !important
// WEATHER_API_KEY, you need an Open Weather API Key
// You can get one for free at: https://home.openweathermap.org/api_keys (account needed).
@mrnovalles
mrnovalles / ios.json
Last active April 6, 2020 15:14
Tonsser JWT tokens for staging ios and android
{
"iss": "https://accounts.google.com",
"azp": "649633060683-qg1qg192072fcgcu88boonels10hahm9.apps.googleusercontent.com",
"aud": "649633060683-qg1qg192072fcgcu88boonels10hahm9.apps.googleusercontent.com",
"sub": "113941317832870254694",
"hd": "tonsser.com",
"email": "mariano@tonsser.com",
"email_verified": true,
"at_hash": "c-bh98_BDOOVnW0zr1ZL3A",
"name": "Mariano Vallés",
#!/bin/sh
echo "List of Github users for pubkey retrieval (space separated):"
read users
for user in $users; do
wget https://github.com/$user.keys -O - >> /home/deploy/.ssh/authorized_keys
done
chown -R deploy:deploy /home/deploy/.ssh
def caseClassToParams(cc: Product) = {
val fields = cc.getClass.getDeclaredFields.map(_.getName)
val keyValues = fields.zip(cc.productIterator.to).toList
keyValues.flatMap {
case ("foo", v) => {
val values = v.toString.split("&").toList
values.map{ p =>
val pair = p.split("=")
(pair.head, pair.last)
}
@mrnovalles
mrnovalles / StartTransmissionVpn.AppleScript
Last active December 23, 2015 09:19
A small script to quit Transmission as soon as the VPN connection is down.
on idle
tell application "System Events"
tell current location of network preferences
set vpnConnection to the service "VPN"
-- Check if Transmission is running
tell application "System Events"
set transmissionIsRunning to (count of (every process whose name is "Transmission")) > 0
end tell
for OG_URL in `cat og_urls.txt`
do
curl -X POST \
-F "id=$OG_URL" \
-F "scrape=true" \
"https://graph.facebook.com"
done
@mrnovalles
mrnovalles / check_listening.sh
Created March 13, 2013 15:33
check processes listening on port
for i in `netstat -na |grep LISTEN |grep -v unix | tr -s ' ' | cut -d " " -f 4 |awk -F. '{print $NF}'`; do echo -e "\n*** Process listening on port $i: ***\n"; sudo lsof -i :$i; done
@mrnovalles
mrnovalles / Preferences.sublime-settings
Created February 22, 2013 16:31
User Preferences .sublime-settings
{
"auto_complete_commit_on_tab": false,
"bold_folder_labels": true,
"color_scheme": "Packages/Tomorrow-Theme/Tomorrow-Night.tmTheme",
"default_line_ending": "unix",
"dictionary": "Packages/Language - English/en_GB.dic",
"file_exclude_patterns":
[
".DS_Store",
".tags*",
@mrnovalles
mrnovalles / signature.erl
Created October 10, 2012 10:16
Erlang signing and verifying hashed data, using openssh keys
-module(signature).
-export([test/0]).
% Looking at using Open SSH public and private keys
% for signing and verifying hashed data.
load_public_key(Filename) ->
{ok, SshBin} = file:read_file(Filename),
[{PubKey,_}] = public_key:ssh_decode(SshBin, public_key),
PubKey.
@mrnovalles
mrnovalles / gist:3800482
Created September 28, 2012 15:20 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt