Skip to content

Instantly share code, notes, and snippets.

⛱️
Hey Corona, I'm working!

Arya Khaligh aryabartar

⛱️
Hey Corona, I'm working!
Block or report user

Report or block aryabartar

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@bradtraversy
bradtraversy / django_cheat_sheet.md
Last active May 29, 2020
Django command cheat sheet
View django_cheat_sheet.md

Django 2.x Cheat Sheet

Creating a virtual environment

We need to create a virtual env for our app to run in: More Here Run this command in whatever folder you want to create your venv folder

python -m venv ./venv
@trongthanh
trongthanh / mojave.xml
Last active Apr 18, 2020
macOS Mojave dynamic background re-implement as GTK+ background slideshow. Background images are changed to reflect the time of the day.
View mojave.xml
<!-- Instructions:
- Download and unzip Mojave dynamic background here: https://files.rb.gd/mojave_dynamic.zip
- Rename the extracted folder as "mojave-background" (Excuse the trouble but I renamed it on my machine and already use that path in the XML file)
- Save this xml file next to the Mojave background files
- Fix the path to the background images below (better using absolute path)
- Lastly, either:
+ GNOME: Use gnome-tweaks tool to select this XML as wallpaper (as default wallpaper settings won't let you choose wallpaper from custom path)
+ MATE: Go to background setting (in Appearance) > Choose +Add... > make sure **All files** filter is selected at the bottom right > Then choose mojave.xml
-->
<background>
@Geoyi
Geoyi / install virtualenv ubuntu 16.04.md
Created Sep 16, 2017 — forked from frfahim/install virtualenv ubuntu 16.04.md
How to install virtual environment on ubuntu 16.04
View install virtualenv ubuntu 16.04.md

How to install virtualenv:

Install pip first

sudo apt-get install python3-pip

Then install virtualenv using pip3

sudo pip3 install virtualenv 
@tralston
tralston / reload-config-postgresql.md
Created Aug 21, 2017
[Reload PostgreSQL config] After updating pg_hba.conf or postgresql.conf, the server needs the config needs to be reloaded. #postgres
View reload-config-postgresql.md

After updating pg_hba.conf or postgresql.conf, the server needs the config needs to be reloaded. The easiest way to do this is by restarting the postgres service:

service postgresql restart

When the service command is not available (no upstart on Synology NAS, for example), there are some more creative ways to reload the config. Note this first one needs to be done under the user that runs postgres (usually the user=postgres).

user#  sudo su postgres
postgres#  pg_ctl reload
@gengue
gengue / serializers.py
Last active May 20, 2020
Django Rest Framework user endpoint with change password
View serializers.py
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from rest_framework import serializers
from .models import User
class UserSerializer(serializers.ModelSerializer):
"""
User accounts serializer
@oliveratgithub
oliveratgithub / made-with-love.html
Last active May 22, 2020
Various HTML-snippets to add "Made with love" to your website
View made-with-love.html
<!-- Example #1 - no styling -->
Made with ❤ in Switzerland
<!-- Example #2 - inline-styled ❤ -->
Made with <span style="color: #e25555;">&#9829;</span> in Switzerland
Made with <span style="color: #e25555;">&hearts;</span> in Switzerland
<!-- Example #3 - CSS-style class for ❤ -->
<style>.heart{color:#e25555;}</style>
Made with <span class="heart"></span> in Switzerland
@jolestar
jolestar / ipsec-shadowsocks.sh
Last active Nov 21, 2019
Run ipsec vpn and shadowsocks by docker, for ubuntu 16
View ipsec-shadowsocks.sh
PASSWORD=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 16 | head -n 1)
apt-get update
apt-get install apt-transport-https ca-certificates
apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
apt-get install linux-image-extra-$(uname -r) linux-image-extra-virtual
echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" | sudo tee /etc/apt/sources.list.d/docker.list
apt-get update
apt-get install -y docker-engine
service docker start
@gabesullice
gabesullice / shell_scripting.md
Last active May 26, 2020
Shell Scripting for Fun and Profit
View shell_scripting.md

A few days ago, I mentioned to Rob Ballou, that there's just something very satisfying about shell scripting. Once you've groked all its little idiosyncracies, it's really quite addictive. As developers, I think we all get some gratification from getting things done, but also from building elegant, complete systems. For me, shell scripting really scratches all those itches. I get to build a system from start to finish, completely self-contained and solve a real problem.

Elegant, complete systems might at first seem antithetical to what most people think of shell scripting. Shell scripting is plagued by weird quoting, strange unfamiliar constructions, and a lack useful data types. However, once you embrace the things that shell scripting is good at and learn a few strategies for writing scripts tidily, it can become a fantastic tool for solving real, every day problems.

So, what are those strategies and what are things that the shell does well?

The Last Template You'll Ever Need

#!/bin/bash
@dkarchmer
dkarchmer / django-filter-sample.py
Created May 2, 2016
How to use django-filter to add a DRF filter using dates and slugs
View django-filter-sample.py
class SampleFilter(filters.FilterSet):
start_date = django_filters.DateFilter(name="date", lookup_type='gte')
end_date = django_filters.DateFilter(name="date", lookup_type='lte')
# How to filter by a foreign key that uses slug as a lookup
foo = django_filters.ModelMultipleChoiceFilter(
queryset=MyModel.objects.all(),
to_field_name='slug',
conjoined=True,
)
class Meta:
@fvcproductions
fvcproductions / sampleREADME.md
Last active May 30, 2020
A sample README for all your GitHub projects.
View sampleREADME.md

FVCproductions

INSERT GRAPHIC HERE (include hyperlink in image)

Repository Title Goes Here

Subtitle or Short Description Goes Here

You can’t perform that action at this time.