Skip to content

Instantly share code, notes, and snippets.

View felipe3dfx's full-sized avatar
🎯
Focusing

Felipe Gonzalez felipe3dfx

🎯
Focusing
View GitHub Profile
@felipe3dfx
felipe3dfx / install-iosevka.sh
Last active May 22, 2023 16:47
install iosevka fonts
RELEASE=$1
mkdir /tmp/iosevka-font/$RELEASE
cd /tmp/iosevka-font/$RELEASE
wget https://github.com/be5invis/Iosevka/releases/download/v$RELEASE/ttf-iosevka-$RELEASE.zip
wget https://github.com/be5invis/Iosevka/releases/download/v$RELEASE/ttf-iosevka-aile-$RELEASE.zip
wget https://github.com/be5invis/Iosevka/releases/download/v$RELEASE/ttf-iosevka-etoile-$RELEASE.zip
wget https://github.com/be5invis/Iosevka/releases/download/v$RELEASE/ttf-iosevka-fixed-$RELEASE.zip
wget https://github.com/be5invis/Iosevka/releases/download/v$RELEASE/ttf-iosevka-fixed-slab-$RELEASE.zip
wget https://github.com/be5invis/Iosevka/releases/download/v$RELEASE/ttf-iosevka-slab-$RELEASE.zip
@felipe3dfx
felipe3dfx / default.site
Created July 16, 2021 20:55
Add whitelist ip to limit request zone nginx
geo $limited {
default 1;
xxx.xxx.xxx/xx 0;
}
map $limited $limit {
1 $binary_remote_addr;
0 "";
}
@felipe3dfx
felipe3dfx / gist:13f6c93ab1071e214258005534efb833
Last active June 1, 2020 22:34
Crear setval en postgres
create sequence enrollment_enrollmentcompany_id_seq;
select max(id) from enrollment_enrollmentcompany;
select setval('enrollment_enrollmentcompany_id_seq', 609, true);
alter table enrollment_enrollmentcompany alter column id set default nextval('enrollment_enrollmentcompany_id_seq');
-- Option 2
CREATE sequence enrollment_enrollmentcompany_id_seq owned by enrollment_enrollmentcompany.id;
SELECT setval(pg_get_serial_sequence('"enrollment_enrollmentcompany"','id'), coalesce(max("id"), 1), max("id") IS NOT null) FROM "enrollment_enrollmentcompany";
ALTER TABLE "enrollment_enrollmentcompany" ALTER COLUMN "id" SET DEFAULT nextval(pg_get_serial_sequence('"enrollment_enrollmentcompany"','id'));
@felipe3dfx
felipe3dfx / gist:15e161176dc1d8222d3ab4200e975003
Created April 6, 2020 12:48
Rsync backup from remote EC2 server
rsync -havzP -e "ssh -i /home/deploy/xxxxx.pem" root@x.x.x.x:/home/deploy/complete-path/ /home/deploy/complete-path/
@felipe3dfx
felipe3dfx / email.py
Created March 5, 2020 15:12
Create email with embedding image
email_message = EmailMultiAlternatives(
subject='subject',
body='some text',
from_email='example@example.com',
to=['example@example'],
)
email_message.attach_alternative(render_to_string('email.html', context), 'text/html')
email_message.mixed_subtype = 'related'
# Image
@felipe3dfx
felipe3dfx / README.md
Last active June 1, 2020 15:42
Setup master server Postgres 12
@felipe3dfx
felipe3dfx / nextcloud_s3_policy.json
Created October 2, 2019 19:37
Next Cloud S3 Policy
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "ListAllBuckets",
"Effect": "Allow",
"Action": [
"s3:ListAllMyBuckets",
"s3:GetBucketLocation"
],
1. Remove old migrations file
find . -path "*/migrations/*.py" -not -name "__init__.py" -delete
find . -path "*/migrations/*.pyc" -delete
2. Make migrations again
python manage.py makemigrations
3. Truncate django_migrations table
TRUNCATE TABLE django_migrations;
@felipe3dfx
felipe3dfx / readme.md
Created February 21, 2019 15:36
Setup google chromium kiosk on raspberry

sudo nano /etc/X11/xorg.conf

Section "ServerFlags"
Option "blank time" "0"
Option "standby time" "0"

Option "suspend time" "0"
Option "off time" "0"
EndSection

Running adhoc commands on multiple servers

Example host file

Using the following /etc/ansible/hosts file:

[app]
192.168.60.4  ansible_user=deploy
192.168.60.5  ansible_user=deploy