- Install daemontools
$ sudo apt-get install daemontools daemontools-run
- Create the service directory if not created by daemontools
$ sudo mkdir -p /etc/service
[Unit] | |
Description=My service | |
After=network.target | |
[Service] | |
ExecStart=/usr/bin/python3 -u example.py | |
WorkingDirectory=/home/user/example/ | |
Restart=always | |
User=username |
#!/usr/bin/env python | |
from __future__ import print_function | |
import json | |
import os | |
import sys | |
# User Variables | |
TYPE = "release" # "release" or "snapshot" | |
JAR_NAME = "{version}.jar" | |
LINK_NAME = "server.jar" |
#include <stdlib.h> // card > cjg.ppm | |
#include <stdio.h> | |
#include <math.h> | |
typedef int i;typedef float f;struct v{ | |
f x,y,z;v operator+(v r){return v(x+r.x | |
,y+r.y,z+r.z);}v operator*(f r){ return | |
v(x*r,y*r,z*r);}f operator%(v r){return | |
x*r.x+y*r.y+z*r.z;}v(){}v operator^(v r | |
){return v(y*r.z-z*r.y,z*r.x-x*r.z,x*r. | |
y-y*r.x);}v(f a,f b,f c){x=a;y=b;z=c;}v |
import os | |
import re | |
import urllib2 | |
class CSServer: | |
def __init__(self, minTier, maxTier, mapType, mapsFilePath, mapsDirectory, fastDlServer = ""): | |
self.MinTier = minTier | |
self.MaxTier = maxTier | |
self.MapType = mapType |
# Text color - normal | |
fgblack="$(tput setaf 0)" # Black | |
fgred="$(tput setaf 1)" # Red | |
fggreen="$(tput setaf 2)" # Green | |
fgyellow="$(tput setaf 3)" # Yellow | |
fgblue="$(tput setaf 4)" # Blue | |
fgpurple="$(tput setaf 5)" # Purple | |
fgcyan="$(tput setaf 6)" # Cyan | |
fgwhite="$(tput setaf 7)" # White |
import MySQLdb | |
import CSServer | |
import time | |
""" | |
This script will update your cs server's maplist file for you based on tiers that are stored in a database. | |
To get it to work, make sure that you have the 'CSServer.py' file in the same directory as this script, | |
then change the variables in the 'global variables' section as needed. | |
This will overwrite the map list file as needed, and will append changes to the new maps text file if enabled. |
sudo rpi-update
sudo reboot
Note: this may enable the Predictable Network Interface Names settings.
Sometimes you need to edit a file on a remote server, but using vim/emacs is not very practical, due to lag and speed of screen refresh.
TextMate users have the classic rmate, but it was implemented in Ruby, which may not be available on the remote server.
A better option is to use this version of rmate, implemented in pure Bash. It's a single file, self-contained, and with no external dependencies.
Step by step: