Skip to content

Instantly share code, notes, and snippets.

Héctor hvalls

Block or report user

Report or block hvalls

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@hvalls
hvalls / google_forms.js
Created Jun 16, 2019
Get last form response and call webhook
View google_forms.js
function onFormSubmit(e) {
var url = //TODO;
var formId = //TODO;
var form = FormApp.openById(formId);
var formResponses = form.getResponses();
var formResponse = formResponses[formResponses.length - 1];
var itemResponses = formResponse.getItemResponses();
var data = itemResponses.map(function(item) {
return { id: item.getItem().getId(), text: item.getItem().getTitle(), response: item.getResponse()};
@hvalls
hvalls / add_safari_bookmark.sh
Last active May 9, 2019
Add Safari bookmark
View add_safari_bookmark.sh
#!/bin/bash
cd /Users/{user}/Library/Safari
while IFS='#' read -r title url
do
/usr/libexec/PlistBuddy Bookmarks.plist -c "Add :Children:1:Children:0 dict"
/usr/libexec/PlistBuddy Bookmarks.plist -c "Add :Children:1:Children:0:URIDictionary dict"
/usr/libexec/PlistBuddy Bookmarks.plist -c "Add :Children:1:Children:0:URIDictionary:title string ${title}"
/usr/libexec/PlistBuddy Bookmarks.plist -c "Add :Children:1:Children:0:URLString string ${url}"
/usr/libexec/PlistBuddy Bookmarks.plist -c "Add :Children:1:Children:0:WebBookmarkType string WebBookmarkTypeLeaf"
@hvalls
hvalls / .gitlab-ci.yml
Created May 2, 2019
Gitlab CI + Heroku container deploy
View .gitlab-ci.yml
#Environment variables: HEROKU_API_KEY, HEROKU_APP
image: ubuntu:bionic
stages:
- deploy
before_script:
# OS dependencies
- apt-get update
@hvalls
hvalls / vault.service
Last active Aug 9, 2018
Terraform Configuration: Hashicorp Vault dev server on AWS EC2 instance
View vault.service
[Unit]
Description=Vault dev server
[Service]
Type=simple
ExecStart=/home/ec2-user/vault server -dev -dev-listen-address=0.0.0.0:8200
@hvalls
hvalls / docker-compose.yml
Last active Nov 23, 2016
Docker: MariaDB and phpMyAdmin
View docker-compose.yml
version: '2'
services:
db:
environment:
- MYSQL_ROOT_PASSWORD=pass
image: mariadb
admin:
links:
- db
ports:
View AndroidUtilities.java
/*
* This is the source code of Telegram for Android v. 3.x.x.
* It is licensed under GNU GPL v. 2 or later.
* You should have received a copy of the license in this archive (see LICENSE).
*
* Copyright Nikolai Kudashov, 2013-2016.
*/
package org.telegram.messenger;
@hvalls
hvalls / Md5.java
Created Apr 13, 2016
MD5 encryption in Android
View Md5.java
import java.io.UnsupportedEncodingException;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
class MD5 {
public String encrypt(String token) {
int RESULT_LENGTH = 16;
@hvalls
hvalls / deploy.bash
Last active Mar 16, 2016
Deployment for Maven projects
View deploy.bash
#!/bin/bash
if [ #$ -lt 1 ]; then
printf "Usage: $0 <environment>"
exit
fi
deploy_host=x.x.x.x
artifact_id=$(mvn help:evaluate -Dexpression=project.artifactId | grep -v '\[')
current_version=$(mvn help:evaluate -Dexpression=project.version | grep -v '\[')
@hvalls
hvalls / Dockerfile.j2
Last active Nov 16, 2018
Docker and Ansible deployment
View Dockerfile.j2
FROM {{registry}}/my-tomcat:1.0.0
ADD {{artifact_id}}.war /usr/local/tomcat/webapp/ROOT.war
{% for dependency in dependencies %}
ADD {{dependency.name}} {{dependency.path}}
{% endfor %}
CMD ["catalina.sh", "run"]
@hvalls
hvalls / kernel_versions
Created Jan 19, 2016
List installed kernel versions
View kernel_versions
dpkg --get-selections | grep linux-image
You can’t perform that action at this time.