Skip to content

Instantly share code, notes, and snippets.

View PythonCoderAS's full-sized avatar

PythonCoderAS PythonCoderAS

  • New York City
  • 01:41 (UTC -05:00)
View GitHub Profile
@PythonCoderAS
PythonCoderAS / script.sh
Created May 21, 2022 19:48
Get markdown URL for Github Repo #github #markdown
#!/bin/bash
DEFAULT="PythonCoderAS" # Change this to your username on GitHub.
function getURL(){
# Usage: getURL <repo name> [optional display name]
REPO="$1"
DISPLAY="${2:-$1}"
if [[ "$REPO" == *"/"* ]]; then
# Do nothing
@PythonCoderAS
PythonCoderAS / script.sh
Created May 14, 2022 14:10
zsh one-liner to get first word from every line in clipboard and separate by spaces #oh-my-zsh #awk #sed
echo `clippaste | awk '{print $1}' | sed 's/://g'` | clipcopy
@PythonCoderAS
PythonCoderAS / gist:c0923bfea82009779acbdca8ad74c772
Last active May 10, 2022 23:57 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@PythonCoderAS
PythonCoderAS / line_to_space.py
Created May 10, 2022 23:45
Python one-liner to convert a newline-separated list of items into a space-separated list of items
import sys;sys.stdout.write(" | ".join(f"\"{word}\"" for word in sys.stdin.read().split("\n")))
@PythonCoderAS
PythonCoderAS / orm.py
Created May 10, 2022 23:09
Template for postgres aerich-compatible tortoise ORM configuration file #tortoise-orm #postgres #asyncpg
from tortoise import Tortoise
project_db = "test"
TORTOISE_ORM = {
"connections": {
"default": {
"engine": "tortoise.backends.asyncpg",
"credentials": {
"user": project_db,
@PythonCoderAS
PythonCoderAS / python-program.service
Created May 10, 2022 23:07
Minimal template for pipenv-powered python service #pipenv #systemd #systemd service
[Unit]
Description=Name
After=network-online.target
[Service]
User=username
WorkingDirectory=/path/to/directory/program/is/in
ExecStart=/usr/local/bin/pipenv run python main.py
[Install]
@PythonCoderAS
PythonCoderAS / script.sh
Created May 10, 2022 22:46
Pipenv make venv in directory #pipenv
PIPENV_VENV_IN_PROJECT=1 pipenv install <packages>
@PythonCoderAS
PythonCoderAS / wordpress.nginx
Created May 9, 2022 22:15
Configuration for wordpress site located at /var/www/wordpress
server {
listen 0.0.0.0:443 http2;
listen [::]:443 http2;
server_name <url>; # Fixme!
ssl on;
ssl_certificate /etc/nginx/certificate.pem;
ssl_certificate_key /etc/nginx/certificate.key;
root /var/www/wordpress;
index index.html index.php;
location = /favicon.ico {
@PythonCoderAS
PythonCoderAS / php-script.nginx
Created May 9, 2022 21:44
Make a nginx server execute php
location ~ \.php$ {
try_files $uri =404;
# To run a specific version, change `php-fpm` to `php<X>.<Y>-fpm.sock`.
fastcgi_pass unix:/var/run/php/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}

Keybase proof

I hereby claim:

  • I am PythonCoderAS on github.
  • I am sarkaraoyan (https://keybase.io/sarkaraoyan) on keybase.
  • I have a public key whose fingerprint is 4559 72EB A0C4 3FBE 0766 EBC1 DD46 631D BF1A 1DB7

To claim this, I am signing this object: