Skip to content

Instantly share code, notes, and snippets.

View abairo's full-sized avatar

Anderson Bairo abairo

  • Curitiba, Paraná - Brasil
View GitHub Profile
@abairo
abairo / fedora-fix-imac-sound
Created March 9, 2018 12:21
Fix fedora problem when plug in headphones
https://unix.stackexchange.com/questions/315140/sound-not-coming-out-of-headphones-in-mint-18-cinnamon-fedora-24-speakers-work
Create the file /etc/modprobe.d/sound.conf
Add options snd_hda_intel model=imac27_122 to the file
Reboot
@abairo
abairo / fedora-fix-nvidia-driver.sh
Created March 9, 2018 12:24
Fix Nvidia driver when update kernel
#!/bin/bash
sudo dnf install kernel-devel xorg-x11-drv-nvidia akmod-nvidia --allowerasing --skip-broken
see the original version in https://ponytech.net/blog/convert-foreign-key-many-to-many-using-django-migrations
Convert a Foreign Key to Many to Many using Django 1.7 buit-in migrations
Django 1.7 comes with a built-in migration system for your data model, replacing the need of a third party module, usually South. This system is pretty good at doing a lot of stuff automatically, but there are some situations where you need to get your hands dirty, especially when there is data migration involved.
This guide will show you, step by step, how to convert a Foreign Key field into a Many to Many, while preserving existing relations.
Initial set up
Let's say you are starting a pizzeria and want your first pizzas to be very simple, they'll have only one topping:
SELECT table_name, column_name, column_default from information_schema.columns where table_name='testing';
SELECT nextval('your_table_id_seq');
SELECT setval('professional_dealer_id_seq', COALESCE((SELECT MAX(id)+1 FROM professional_dealer), 1), false);
Source: https://cubethethird.wordpress.com/2016/06/14/eliminate-screen-tearing-with-amd-gpu-on-ubuntu/
create or edit 20-radeon.conf in /usr/share/X11/xorg.conf.d/:
Section "Device"
Identifier "Radeon"
Driver "radeon"
Option "TearFree" "on"
EndSection
def jws_filter_date():
if birth_month_begin == birth_month_end:
# Same month
queryset = User.objects.filter(
birth_date__month=birth_month_begin,
birth_date__day__gte=birth_day_begin,
birth_date__day__lte=birth_day_end
)
else:
queryset = User.objects.filter(
csvfile = request.FILES.get('csv_file', None)
csv_bytes = csvfile.file.read()
csv_rows = rows.import_from_csv(BytesIO(str.encode(csv_bytes.decode('iso-8859-1'))))
https://turanct.wordpress.com/2013/02/14/swap-left-ctrl-and-alt-keys-on-ubuntu-and-other-distros/
Create a file in your home dir: ~/.Xmodmap and put this in it:
clear control
clear mod1
keycode 37 = Alt_L Meta_L
keycode 64 = Control_L
add control = Control_L Control_R
add mod1 = Alt_L Meta_L

Start by getting the correct theme name to use in the next steps:

cat .icons/Breeze-Hacked/index.theme
[Icon Theme]
Name=Breeze-Hacked

So you need

obj = JSON.parse(atob('sdflkljkls.jklsdkfl4334456egfdg45hjkis.iowewiockwo'.split('.')[1]))
dt = new Date()
dt1 = new Date(1565106594 * 1000)