Skip to content

Instantly share code, notes, and snippets.

View tormath1's full-sized avatar

Mathieu Tortuyaux tormath1

View GitHub Profile
@tormath1
tormath1 / script.sh
Created December 10, 2018 13:21
automagically update your archlinux
# /etc/systemd/system/update.timer
[Unit]
Description=Perform a full upgrade once a week (at 12:00pm on Monday)
[Timer]
OnCalendar=Mon *-*-* 12:00:00
Persistent=true
[Install]
WantedBy=timers.target
#!/usr/bin/python
import requests
def get_quote():
return requests.get("https://breaking-bad-quotes.herokuapp.com/v1/quotes").json()[0]
def format_quote(q):
author = q.get("author")
quote = q.get("quote")
return f"'{quote}' - {author}"
@tormath1
tormath1 / validate.log
Created August 6, 2019 12:19
packer validate build.json
PACKER_LOG=1 packer validate build.json
2019/08/06 14:17:59 [INFO] Packer version: 1.4.2
2019/08/06 14:17:59 Packer Target OS/Arch: linux amd64
2019/08/06 14:17:59 Built with Go Version: go1.12.7
2019/08/06 14:17:59 Detected home directory from env var: /home/mathieu
2019/08/06 14:17:59 Using internal plugin for amazon-chroot
2019/08/06 14:17:59 Using internal plugin for azure-arm
2019/08/06 14:17:59 Using internal plugin for alicloud-ecs
2019/08/06 14:17:59 Using internal plugin for lxc
2019/08/06 14:17:59 Using internal plugin for parallels-iso
@tormath1
tormath1 / connect.sh
Created June 3, 2020 18:18
IpV6 - socket connect - assembly 64bits
$ cat > connect.asm << EOF
SECTION .text
global _start
_start:
xor rax, rax ; init 0
xor rdx, rdx ; init 0
xor rsi, rsi ; init 0
@tormath1
tormath1 / otp.py
Created June 10, 2020 08:55
OTP - Encryt / Decrypt example
import sys
import string
import random
# return a key of the size
# of the PT
def generate_key(length):
r = lambda: \
string.ascii_letters[int(random.random() * len(string.ascii_letters))]
key = b''
@tormath1
tormath1 / main.py
Created October 21, 2020 07:39
simple tkinter frame with inheritance
import tkinter
class Test(tkinter.Frame):
def __init__(self, parent):
tkinter.Frame.__init__(self, parent)
# create entry class attribute
self.entry = tkinter.Entry(self)
self.entry.grid(row=0, column=1)
@tormath1
tormath1 / main.go
Created November 8, 2020 17:59
NTP Go Client
package main
import (
"bufio"
"bytes"
"encoding/binary"
"fmt"
"net"
"os"
"time"
{"format_version":"0.1","terraform_version":"0.13.5","planned_values":{"root_module":{"child_modules":[{"resources":[{"address":"module.k8s.data.ignition_config.ignition[0]","mode":"data","type":"ignition_config","name":"ignition","index":0,"provider_name":"registry.terraform.io/terraform-providers/ignition","schema_version":0,"values":{"append":[],"arrays":null,"directories":null,"disks":null,"files":["{\"filesystem\":\"root\",\"group\":{},\"path\":\"/etc/hostname\",\"user\":{},\"contents\":{\"source\":\"data:text/plain;charset=utf-8;base64,bm9kZS0wMA==\",\"verification\":{}},\"mode\":420}"],"filesystems":null,"groups":null,"links":null,"networkd":["{\"contents\":\"[Match]\\nName=eth0\\n\\n[Network]\\nDHCP=ipv4\\n\",\"name\":\"00-wired.network\"}"],"replace":[],"systemd":[null,"{\"contents\":\"[Unit]\\nDescription=Setup Network Environment\\nDocumentation=https://github.com/kelseyhightower/setup-network-environment\\nRequires=network-online.target\\nAfter=network-online.target\\n\\n[Service]\\nExecStartPre=-
import json
import sys
if len(sys.argv) < 3:
print(f"usage: {sys.argv[0]} resources.tfstate resources12.tfstate")
exit(1)
source = sys.argv[1]
dest = sys.argv[2]