Skip to content

Instantly share code, notes, and snippets.

View gonfva's full-sized avatar

Gonzalo Fernández-Victorio gonfva

View GitHub Profile
@gonfva
gonfva / Recipe.md
Created August 2, 2023 14:27
A random Gitlab error encryption

So I was getting the following error while trying to delete a project

   "lib/gitlab/crypto_helper.rb:28:in `aes256_gcm_decrypt'",
    "app/models/concerns/token_authenticatable_strategies/encryption_helper.rb:18:in `decrypt_token'",
    "app/models/concerns/token_authenticatable_strategies/encrypted.rb:78:in `get_encrypted_token'",
    "app/models/concerns/token_authenticatable_strategies/encrypted.rb:113:in `token_set?'",
    "app/models/concerns/token_authenticatable_strategies/base.rb:44:in `ensure_token'",
    "app/models/concerns/token_authenticatable_strategies/encrypted.rb:38:in `ensure_token'",
    "app/models/concerns/token_authenticatable.rb:49:in `block in add_authentication_token_field'",
@gonfva
gonfva / download.py
Created April 18, 2023 18:28
A quick script to download messages from some place
import requests
import json
import sqlite3
import time
# Define the API endpoint URL and bearer token
bearer_token = <put token>
server_url = https://api.<something here>.com/chat/v2/conversations/
@gonfva
gonfva / Webhook confiiguration
Created January 18, 2019 14:41
Admission controllers (still not working)
apiVersion: admissionregistration.k8s.io/v1beta1
kind: ValidatingWebhookConfiguration
metadata:
name: pullPolicyMutator
webHooks:
- name: mutator
rules:
- apiGroups:
- ""
apiVersions:
@gonfva
gonfva / keybase.md
Last active September 24, 2016 17:56

Keybase proof

I hereby claim:

  • I am gonfva on github.
  • I am gonfva (https://keybase.io/gonfva) on keybase.
  • I have a public key ASDn5E7Y5OcRcxi66aLWilB0frYEzPF3lqAWAVM9ou7OOQo

To claim this, I am signing this object:

public class CheckUser {
public String checkUser(SESEvent event, Context c) {
c.getLogger().log("Inside the function\n");
if (event == null || event.getRecords() == null) {
c.getLogger().log("Events is null\n");
return "STOP_RULE";
}
return "CONTINUE";
}
}
@gonfva
gonfva / gist:473494a11e4614a60159
Created April 30, 2014 12:52
Command to change the default analyzer for an index
curl -XPUT http://localhost:9200/test -d'
{
"index" : {
"analysis" : {
"analyzer" : {
"default" : {
"char_filter" : [
"html_strip"
],
"tokenizer" : "standard"
@gonfva
gonfva / gist:7633925
Created November 24, 2013 23:29
99android.rules for an Xperia U (ST25i)
SUBSYSTEMS==”usb”, ATTRS{idVendor}==”0fce″, ATTRS{idProduct}==”0171″, MODE=”0666″
SUBSYSTEMS==”usb”, ATTRS{idVendor}==”0fce″, ATTRS{idProduct}==”0dde″, MODE=”0666″
SUBSYSTEMS==”usb”, ATTRS{idVendor}==”0fce″, ATTRS{idProduct}==”adde″, MODE=”0666″
@gonfva
gonfva / gist:7519177
Created November 17, 2013 22:35
Script to update a running server (rvm+puma+nginx)
#!/bin/bash
pwd=*****
if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then
# First try to load from a user install
source "$HOME/.rvm/scripts/rvm"
elif [[ -s "/usr/local/rvm/scripts/rvm" ]] ; then
# Then try to load from a root install
@gonfva
gonfva / gist:7519157
Created November 17, 2013 22:33
Script to update No-IP
#!/bin/bash
user=*****
password=******
useragent="SomethingUNIQUE/1 email@example.com"
testippath=******
oldIP=`cat $testippath/currentIP`
myIP=`curl -s "http://wtfismyip.com" | grep -o "[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}"`
@gonfva
gonfva / spring-business-context.xml
Created October 1, 2012 13:39
Crash course to Spring MVC with transactions
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:jee="http://www.springframework.org/schema/jee" xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd
http://www.springframework.org/schema/aop http://www.sp