Skip to content

Instantly share code, notes, and snippets.

View agalazis's full-sized avatar
🌴
On vacation

Andreas Galazis agalazis

🌴
On vacation
View GitHub Profile
@agalazis
agalazis / python_default_arguments.py
Last active January 17, 2024 09:13
Python default arguments example
# python defaults
import sys
def value_generator():
yield "first_value"
yield "this will never be returned because I am called once on parse"
values=value_generator()
def foo():
print("executing foo look at me I am called before runnig main :p")
@agalazis
agalazis / linux_performance.md
Last active August 11, 2023 15:21 — forked from Nihhaar/linux_performance.md
Linux simple performance tweaks

Linux simple performance tweaks

Change the I/O Scheduler

Open $ vim /etc/default/grub then add elevator=noop next to GRUB_CMDLINE_LINUX_DEFAULT. Run $ update-grub and $ cat /sys/block/sda/queue/scheduler to be sure that noop is being used:

$ vim /etc/default/grub
$ update-grub
$ cat /sys/block/sda/queue/scheduler

[noop] deadline cfq

@agalazis
agalazis / git-hooks-setup
Last active March 27, 2023 16:30
gitlab ticket commit messages
#!/bin/bash
RED='\033[1;31m'
NORMAL='\033[0m'
remove_hook() {
dir=$1
rm "$dir/.git/hooks/prepare-commit-msg"
echo "Removed hook from $dir/.git/hooks/prepare-commit-msg"
}
add_hook() {
@agalazis
agalazis / postgresql_date_function_index_howto.md
Created March 22, 2022 18:35 — forked from cobusc/postgresql_date_function_index_howto.md
Short explanation of the issues faced when trying to create a PostgreSQL index using the date() function and how to resolve it.

Given a table...

CREATE TABLE foo (
  id SERIAL PRIMARY KEY,
  created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
  ...
);
git for-each-ref --sort=taggerdate --format '%(tag)%(taggerdate)' | grep 2020 |wc -l
@agalazis
agalazis / ptgd sites.txt
Created October 27, 2019 14:53
Put the glass down sites...
https://blogs.dropbox.com/tech/
http://www.bash.org/?latest
http://www.commitstrip.com/en/?
https://www.monkeyuser.com/
https://devrant.com/search?term=joke&sort=algo
https://devdojo.com/fun
https://www.codemopolitan.com/
https://thecodinglove.com/
yes yes |for d in ./*/ ; do (cd "$d" &&terraform init && terraform 0.12upgrade ); done
@agalazis
agalazis / postman_fc29_install.sh
Created May 4, 2019 17:08 — forked from udomsak/postman_fc29_install.sh
Install postman on Fedora core 29 - Dec 2018
#!/bin/bash
wget https://dl.pstmn.io/download/latest/linux64 -O postman-linux-x64.tar.gz
sudo tar xvzf postman-linux-x64.tar.gz -C /opt
sudo ln -s /opt/Postman/Postman /usr/bin/postman
cat << EOF > ~/.local/share/applications/postman2.desktop
[Desktop Entry]
Name=Postman
GenericName=API Client
create-nx-workspace modulename --npm-scope=@modulename
ng generate lib components
ng generate module atoms --app="components"
ng generate module molecules --app="components"
ng generate module organisms --app="components"
ng generate app hospital-admin --routing
npm i -g @storybook/cli@4.0.0-alpha.8
npm i --save-dev babel-core react react-dom
ng generate component atoms/input-field --app=components
@agalazis
agalazis / python-es6-comparison.md
Created April 7, 2018 11:55 — forked from revolunet/python-es6-comparison.md
# Python VS ES6 syntax comparison

Python VS ES6 syntax comparison

Python syntax here : 2.7 - online REPL

Javascript ES6 via Babel transpilation - online REPL

Imports

import math