Skip to content

Instantly share code, notes, and snippets.

View aVolpe's full-sized avatar
:electron:
Hacking

Arturo Volpe aVolpe

:electron:
Hacking
View GitHub Profile
@aVolpe
aVolpe / fzf-change-audio-source.zsh
Last active January 8, 2024 17:00
fzf SwitchAudioSource
foutput() {
# usage:
# foutput # to open picker
# foutput speakers # to select speakers
device="$(SwitchAudioSource -a -t output |\
fzf-tmux --height=8 --cycle --no-mouse --no-multi --query=$1 -1 |\
cut -f1 -d'(' | xargs)"
SwitchAudioSource -s "$device"
}
@aVolpe
aVolpe / Vibration.cs
Created October 16, 2014 02:45
Vibration for Unity3d with Android native Call, with fallback to Handlheld.Vibrate()
using UnityEngine;
using System.Collections;
public static class Vibration
{
#if UNITY_ANDROID && !UNITY_EDITOR
public static AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
public static AndroidJavaObject currentActivity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
public static AndroidJavaObject vibrator = currentActivity.Call<AndroidJavaObject>("getSystemService", "vibrator");
@aVolpe
aVolpe / setupi18n.ts
Created March 9, 2023 21:42
i18next react with traduora
export async function setupI18n(config: {
traduora: {
host: string,
projectId: string,
clientId: string,
clientSecret: string
}
}) {
const token = await getTraduoraToken(config.traduora);
@aVolpe
aVolpe / paraguay.json
Created February 10, 2016 22:34
GeoJson de los departamentos del Paraguay
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@aVolpe
aVolpe / send_iso_message.py
Last active July 28, 2022 21:05
jpos utils
#!/usr/bin/python
import sys
import xml.etree.cElementTree as ET
import string
import random
import socket
from datetime import datetime
if len(sys.argv) < 2:
@aVolpe
aVolpe / package.json
Last active July 20, 2022 12:32
Build a angular-cli project with maven
{...
"scripts": {
"ng": "ng",
"start": "ng serve --proxy-config proxy.conf.json",
"clean": "rm -rf dist",
"build-prod": "yarn install && ng build -prod",
"build-dev": "yarn install && ng build -dev",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
@aVolpe
aVolpe / EmbeddedGist.js
Created September 13, 2016 22:58
EmbeddedGist allows a gist to be embedded in a React application
import React, { Component } from 'react';
class EmbeddedGist extends Component {
constructor(props) {
super(props);
this.gist = props.gist;
this.file = props.file;
this.stylesheetAdded = false;
this.state = {
@aVolpe
aVolpe / check_ram.js
Last active March 29, 2021 20:52
Check the ram of a jvm process using nashron (given only a jre)
function addUrlToClasspath(pathName) {
var/*java.net.URLClassLoader*/
sysloader = /*(java.net.URLClassLoader) */ java.lang.ClassLoader.getSystemClassLoader();
var/*java.lang.Class*/ sysclass = java.net.URLClassLoader.class;
var ClassArray = Java.type("java.lang.Class[]");
var parameters = new ClassArray(1);
parameters[0] = java.net.URL.class;
var/*java.lang.reflect.Method*/ method = sysclass.getDeclaredMethod("addURL", parameters);
method.setAccessible(true);
var ObjectArray = Java.type("java.lang.Object[]");
@aVolpe
aVolpe / scraper.py
Last active August 18, 2020 14:21
Extractor de información histórica de cotizaciones en Paraguay
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Dependencias:
# - beautifulsoup4
import sys
import time
import urllib
import urllib.request
@aVolpe
aVolpe / generate_rows.py
Created July 3, 2020 15:26
Contraloria
#!/usr/bin/python3
import sys
import re
def get_file_data(file_name):
cleaned = file_name \
.replace('PERDOMO2016_1', 'PERDOMO_2016_1') \
.replace('SOSARIELLA_216', 'SOSARIELLA_2016') \
.replace('221.035', '221035') \