Skip to content

Instantly share code, notes, and snippets.

View misTrasteos's full-sized avatar

Álvar Torres misTrasteos

  • Madrid, Spain
View GitHub Profile
@misTrasteos
misTrasteos / git_cheat_sheet.md
Last active October 26, 2022 11:39
Git cheat sheet

git config

alias

git config --global alias.l 'log --oneline'

git commit

--amend Replace the tip of the current branch by creating a new commit

--allow-empty

-a, --all Tell the command to automatically stage files that have been modified and deleted, but new files you have not told Git about are not affected.

@misTrasteos
misTrasteos / README.md
Created October 8, 2022 19:48
remove password from [a lot of ]pdf files
  • I am using Ubuntu latest

docker run --rm --name pdfs -it -v /pdfs:/pdfs -w /pdfs ubuntu:latest

  • Install pdftk
apt-get update
apt-get upgrade
apt-get install pdftk
@misTrasteos
misTrasteos / playbook.yaml
Created April 27, 2022 19:21
Ansible dynamic inventory add_host example
# ansible-playbook -e new_machine_name=new_machine playbook.yaml
---
- name: "Provision machine"
hosts: "localhost"
tasks:
- name: "Create machine ..."
docker_container:
name: "{{ new_machine_name }}"
hostname: "{{ new_machine_name }}"
command: ["sleep", "infinity"]
@misTrasteos
misTrasteos / lichesAPI.md
Last active April 22, 2022 09:00
Lichess API

How to ...

... export games of a user

Official Docs

curl --location --request GET 'https://lichess.org/api/games/user/{USER}?max=1&analysed=true&clocks=true&evals=true&opening=true&literate=true' \
--header 'Authorization: Bearer {PAT}'
@misTrasteos
misTrasteos / prometheus.yaml
Created April 4, 2022 15:45
Prometheus in k8s example
apiVersion: v1
kind: Service
metadata:
name: prometheus-service
spec:
ports:
- name: http
port: 9090
targetPort: 9090
selector:
@misTrasteos
misTrasteos / TwitterSerialExample.java
Created March 3, 2022 07:05
Twitter Serial example
///usr/bin/env jbang "$0" "$@" ; exit $?
//JAVA 17
//DEPS com.twitter.serial:serial:0.1.6
/// https://github.com/twitter/Serial
import java.io.IOException;
# APT
## Package version before installing it
```
apt list azure-cli
Listing... Done
azure-cli/bullseye 2.33.1-1~bullseye all
N: There are 9 additional versions. Please use the '-a' switch to see them.
apt list -a azure-cli
Listing... Done
@misTrasteos
misTrasteos / InternStringsExample.java
Last active January 26, 2022 16:11
Java Intern Strings Example
///usr/bin/env jbang "$0" "$@" ; exit $?
import java.util.List;
import java.util.LinkedList;
public class InternStringsExample {
public static void main(String... args) throws Exception {
List<String> strings = new LinkedList<String>();
@misTrasteos
misTrasteos / CleanerAPIAutoCloseableExample.java
Last active December 27, 2021 13:27
Java Cleaner API with AutoCloseable example
//JAVA_OPTIONS -Xms8m -Xmx8m -XX:+UseSerialGC
//JAVA_OPTIONS -XX:-DisableExplicitGC
/// https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/ref/Cleaner.html
import java.lang.AutoCloseable;
import java.lang.ref.Cleaner;
public class CleanerAPIAutoCloseableExample{
@misTrasteos
misTrasteos / CompactStringsExample.java
Last active December 21, 2021 18:00
Compact Strings example in Java
///usr/bin/env jbang "$0" "$@" ; exit $?
//DEPS org.apache.commons:commons-lang3:3.12.0
//JAVA_OPTIONS -Xms128m -Xmx128m
//JAVA_OPTIONS -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC
//JAVA_OPTIONS -XX:+HeapDumpOnOutOfMemoryError
import org.apache.commons.lang3.RandomStringUtils;