Skip to content

Instantly share code, notes, and snippets.

View alexmon's full-sized avatar

Alex Monastiriotis alexmon

  • EveryPay
  • Greece
View GitHub Profile
@alexmon
alexmon / podman-release-is-not-valid.yaml
Created April 15, 2022 12:45
Podman build image prints 'Release is not valid yet'
Getting 'Release is not valid yet' on image build ?
try stop / start the podman machine
```bash
podman machine stop
podman machine start
```
@alexmon
alexmon / macos-monterey-setup-dnsmasq.sh
Created March 6, 2022 17:15
MacOS Monterey setup dnsmasq
brew install dnsmasq
echo 'address=/.test/127.0.0.1' > /opt/homebrew/etc/dnsmasq.conf
sudo brew services start dnsmasq
sudo mkdir -v /etc/resolver
sudo bash -c 'echo "nameserver 127.0.0.1" > /etc/resolver/test'
@alexmon
alexmon / .vimrc
Created March 3, 2022 15:25
.vimrc
filetype on
filetype plugin on
filetype indent on
set number
set cursorline
set hlsearch
set title
syntax on
# Given an array of integers greater than zero, find if it is possible to
# split it in two (without reordering the elements), such that the sum
# of the two resulting arrays is the same. Print the resulting arrays.
# In [1]: can_partition([5, 2, 3])
# Output [1]: ([5], [2, 3])
# Return [1]: True
#
# In [2]: can_partition([2, 3, 2, 1, 1, 1, 2, 1, 1])
# Output [2]([2, 3, 2], [1, 1, 1, 2, 1, 1])
USER=${2-myusername}
PASSWORD=${3-mypassword}
HOST=${4-jenkins_host}
curl --user $USER:$PASSWORD\
-k \
-X POST \
-F "jenkinsfile=<$1" \
$HOST/pipeline-model-converter/validate
@alexmon
alexmon / start-pg-docker.sh
Created May 23, 2019 16:04
start Postgres using Docker
docker run --rm --name pg-docker -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -d -p 5432:5432 -v $HOME/docker/volumes/postgres:/var/lib/postgresql/data postgres
@alexmon
alexmon / ts-node-url-with-params.ts
Last active October 13, 2018 12:19
create URL string with query parameters in Node (TypeScript)
/**
*
* @param {string} host
* @param {string} path
* @param {Array<[string, string]>} paramList
* @returns {string}
*/
function createStringifiedURI(host: string, path: string, paramList: Array<[string, string]>): string {
const uri = new URL(
path,
@alexmon
alexmon / serve_local_dir.sh
Created October 3, 2017 11:01
serve current directory using python3
python3 -m http.server
@alexmon
alexmon / read.file.observable.ts
Created September 29, 2017 12:11
Read asynchronously File data returned as Observable
/**
* creates and returns a cold observable that emits raw data read asynchronously from a File object
* @param {File} file
* @returns {Observable<string>}
*/
export function getFileRawDataAsObservable(file: File): Observable<string> {
return new Observable<string>(
function (observer) {
const reader = new FileReader();
reader.onloadend = function(event: any) {
@alexmon
alexmon / delete-old-backups.sh
Last active September 9, 2017 12:03
delete previous month daily backups using bash
# assume you keep a daily backup from a database application, e.g mysql
# backup filenames format is "dbname.%Y%m%d.sql" and are kept under folder named "dbname"
# declare list of folder names which contain sql dumps
declare -a dbList=("db1" "db2")
# iterate the list
for i in "${dbList[@]}"
do
# using find command add -delete option to delete files