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
View python_default_arguments.py
# 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
View linux_performance.md

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
View git-hooks-setup
#!/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.
View postgresql_date_function_index_howto.md

Given a table...

CREATE TABLE foo (
  id SERIAL PRIMARY KEY,
  created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
  ...
);
View gist:5a75570b0e78328636b944b873900caf
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...
View ptgd sites.txt
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/
View gist:c522a4e0dd6e6205d07fe7827d88e799
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
View postman_fc29_install.sh
#!/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
View gist:ef3ae658c416ecfbf3e9d5544d8dc9bc
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
View python-es6-comparison.md

Python VS ES6 syntax comparison

Python syntax here : 2.7 - online REPL

Javascript ES6 via Babel transpilation - online REPL

Imports

import math