sqlalchemy
class Page(Base):
__tablename__ = 'pages'
user_id = Column(Integer, ForeignKey('users.id'), nullable=False)
class User(Base):
const epoch = 1970 | |
const dayInSeconds = 86400 | |
const hourInSeconds = 3600 | |
const minuteInSeconds = 60 | |
const dayInHours = 24 | |
const toInt = v => parseInt(v) | |
const isLeap = v => ((v % 4 == 0) && (v % 100 != 0)) || (v % 400 == 0) | |
const pad = (v, n = 2) => v.toString().padStart(n, '0') |
package main | |
import ( | |
"flag" | |
"log" | |
"net/http" | |
) | |
func main() { | |
port := flag.String("p", "8100", "port to serve on") |
See how a minor change to your commit message style can make a difference. Examples
<type>(<optional scope>): <description> empty separator line <optional body>
from django.db import models | |
from rest_framework import serializers | |
class MyModel(models.Model): | |
name = models.CharField(max_length=100) | |
description = models.TextField() | |
created_at = models.DateTimeField(auto_now_add=True) | |
updated_at = models.DateTimeField(auto_now=True) | |
def __str__(self): |
[Desktop Entry] | |
Version=1.1 | |
Type=Application | |
Name=Google Chrome | |
GenericName=Web Browser | |
Comment=Access the Internet | |
Icon=google-chrome | |
Exec=/usr/bin/google-chrome-stable --force-device-scale-factor=1 --password-store=gnome-libsecret %U | |
Actions=new-window;new-private-window; | |
MimeType=application/pdf;application/rdf+xml;application/rss+xml;application/xhtml+xml;application/xhtml_xml;application/xml;image/gif;image/jpeg;image/png;image/webp;text/html;text/xml;x-scheme-handler/http;x-scheme-handler/https; |
[ | |
[ | |
"_record", | |
"cmd", | |
[ | |
"norecord", | |
"release" | |
], | |
"Record a demo incrementally.\n" | |
], |
#!/bin/bash | |
SRCDS_TOKEN="..." | |
CS2_RCON_PORT=1002 | |
CS2_PORT=27015 | |
CS2_RCONPW="changeme" | |
CS2_PW="changeme" | |
CS2_MAXPLAYERS=10 | |
CS2_ADDITIONAL_ARGS="" | |
CS2_GAMEALIAS="competitive" # competitive, wingman, casual, deathmatch, custom | |
CS2_MAPGROUP="mg_active" |
#!/usr/bin/env python3 | |
""" | |
License: MIT License | |
Copyright (c) 2023 Miel Donkers | |
Very simple HTTP server in python for logging requests | |
Usage:: | |
./server.py [<port>] | |
""" | |
from http.server import BaseHTTPRequestHandler, HTTPServer |
#!/bin/bash | |
# Usage: killover.sh nginx john 3 | |
# Which means john can have maximum 3 nginx processes, the newest ones must be killed. | |
cmd=$1 | |
user=$2 | |
max_pids=$3 | |
pids="$(ps --sort=start_time --user "$user" --format pid,cmd | grep "$cmd" | awk '{print $1}')" | |
pids_count=$(echo "$pids" | wc -l) |