Skip to content

Instantly share code, notes, and snippets.

View imrehg's full-sized avatar
🐒
Chaos Monkey

Gergely Imreh imrehg

🐒
Chaos Monkey
View GitHub Profile
@imrehg
imrehg / batchdelete.py
Last active February 1, 2021 16:03
Batch delete files from a versioned S3 bucket
import argparse
import math
import sys
from concurrent.futures import ThreadPoolExecutor, as_completed
import boto3
from tqdm.auto import tqdm
client = boto3.client("s3")
objects = []
@imrehg
imrehg / QREncrypter.cs
Last active December 16, 2020 08:46
QR code encryption code for Taiwanese electronic invoice
namespace tw.gov.nat.einvoice.qrutil {
using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;
public class QREncrypter {
public string AESEncrypt(string plainText, string AESKey) {
byte[] bytes = Encoding.Default.GetBytes(plainText);
ICryptoTransform transform = new RijndaelManaged { KeySize = 0x80, Key = this.convertHexToByte(AESKey), BlockSize = 0x80, IV = Convert.FromBase64String("Dt8lyToo17X/XkXaQvihuA==") }.CreateEncryptor();
@imrehg
imrehg / 00_README.md
Last active August 11, 2020 13:27
Custom Python environment

Setting up a custom Python environments with Conda on Faculty Platform

The following scripts provide a foundation to use a different Python version on the the Faculty Platform servers than what's shipped in the default Python2 and Python3 Conda environments (Python 2.7.16 and 3.6.10 respectively, at the time of writing). These scripts are intended to be a quick fix while the Platform implements support for newer Python versions, and thus there are quirks of behaviour to take into account, as explained in this documentation.

There are 3 scripts attached here:

@imrehg
imrehg / GithubActions_jobs_trigger_overview.png
Last active March 17, 2020 16:59
GitHub Actions with Faculty Platform
GithubActions_jobs_trigger_overview.png
@imrehg
imrehg / README.md
Last active March 10, 2020 12:11
HiPlot with the Faculty Platform

Visualising experiments with HiPlot on the Faculty Platform

HiPlot is a tool for high-dimentiomnal visualisation, that comes handy for example when running hyperparameter optimisation of machine learning models. This readme collects some usage notes to make most of both experiment tracking on the Faculty Platform and HiPLot.

See the HiPlot documentation for more details on any HiPLot related information.

@imrehg
imrehg / disable-ethernet
Created August 20, 2019 21:09
Disable Ethernet with NM connection file
[connection]
id=Disable Ethernet
uuid=8377ffac-b6ff-4034-a910-be325524b925
type=ethernet
autoconnect=false
[ethernet]
mac-address-blacklist=
[ipv4]
systemctl stop resin-supervisor
balena rm -f $(balena ps -a -q) || true
balena tag $(balena images | grep registry2 | awk '{print $1}') backup
balena rmi $(balena images | grep registry2 | awk '{print $1}')
systemctl restart resin-supervisor
while ! balena images | grep -q registry2 ; do echo "waiting on supervisor download, sleeping 5s" && sleep 5; done
echo "download finished, removing temporary image tags"
balena rmi backup
#!/bin/bash
# Check succeeds if file found to be modified in shorter time than threshold
[[ -n "$(find /data/container_healthchecks/balena_tags -mmin -21)" ]]
@imrehg
imrehg / disable-ethernet
Last active March 19, 2019 17:32
Network Manager disable ethernet
[connection]
id=disable-ethernet
uuid=35a68233-05e3-4ef0-9150-9a4099f32344
type=ethernet
autoconnect=false
permissions=
[ethernet]
mac-address-blacklist=
[connection]
id=huawei-gsm
type=gsm
[gsm]
apn=rsaweb.mobi
[ipv4]
dns-search=
method=auto