Skip to content

Instantly share code, notes, and snippets.

View connorjan's full-sized avatar

Connor Goldberg connorjan

View GitHub Profile
@connorjan
connorjan / rsub.md
Last active March 6, 2024 21:06
Editing Files Remotely via SSH on SublimeText 3

Editing Files Remotely via SSH on SublimeText 3

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:

@connorjan
connorjan / shairport-sync-install.md
Last active December 16, 2023 13:22
shairport-sync installation for a Raspberry Pi
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.
@connorjan
connorjan / shellcolors.sh
Created July 26, 2017 02:21
Definitions for the shell colors (and other attributes) through tput
# 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

Using PIP to Download Packages for Offline Installation on a Different Platform

  1. On your device with access to the network, download the package and its requirements:

pip install <package> --download=<download-directory> --no-binary=:all:

or

pip download <package>

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
@connorjan
connorjan / Monitoring Processes on Raspberry Pi.md
Last active July 4, 2019 08:48
How to setup daemontools to monitor processes on Raspberry Pi

Monitoring Processes on Raspberry Pi

  1. Install daemontools

$ sudo apt-get install daemontools daemontools-run

  1. Create the service directory if not created by daemontools

$ sudo mkdir -p /etc/service

#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
@connorjan
connorjan / mcupdate.py
Last active December 10, 2018 00:32
Script to update minecraft to the latest version
#!/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"
@connorjan
connorjan / example.service
Last active January 8, 2018 02:08
Making a systemd service
[Unit]
Description=My service
After=network.target
[Service]
ExecStart=/usr/bin/python3 -u example.py
WorkingDirectory=/home/user/example/
Restart=always
User=username