This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
[ | |
"_record", | |
"cmd", | |
[ | |
"norecord", | |
"release" | |
], | |
"Record a demo incrementally.\n" | |
], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Usage: ./conn-uptime.sh MyConnectionName | |
conn=$1 | |
timestamp1=$(nmcli -f connection.timestamp conn show $conn | awk '{print $2}') | |
current_time=$(date +%s) | |
duration=$((current_time - timestamp1)) | |
echo "Duration since last network connection: $duration seconds" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# If not running interactively, don't do anything | |
case $- in | |
*i*) ;; | |
*) return;; | |
esac | |
# paths | |
export PATH=$HOME/bin:/usr/local/bin:$PATH | |
export PATH=$PATH:$HOME/.node/bin | |
export PATH=$PATH:$HOME/.local/bin |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# tested with [email protected] on Debian@11 | |
# | |
# Setup: | |
# sudo apt install mdbtools -y | |
# | |
# Usage: | |
# bash ./acc2sql.sh mydb.accdb mydb.sql | |
## |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socks | |
from time import time | |
from dataclasses import dataclass | |
from http.client import HTTPConnection, HTTPSConnection, HTTPResponse | |
from urllib.parse import urlparse | |
USER_AGENT = ( | |
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) " |