Skip to content

Instantly share code, notes, and snippets.

View peterc's full-sized avatar
🏠
Working from home

Peter Cooper peterc

🏠
Working from home
View GitHub Profile
@amirrajan
amirrajan / subspace.rb
Created February 27, 2019 21:50
Initial work for a subspace clone written on top of a game engine I'm working out that hasn't been released yet.
class Game
attr_accessor :_
def default_ship x, y, heading
_.new(:ship) do |s|
s.x = x
s.y = y
s.dy = 0
s.dx = 0
s.heading = heading
@fnky
fnky / ANSI.md
Last active May 13, 2025 07:41
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@hsed
hsed / vastai.md
Last active December 11, 2023 22:08
Vast.ai VPN Setup Commands

Commands

Remote => Server/GPU Computer Client => You/Dumb Computer

SSH and tunnel a port

This allows you to later run jupyterlab at 8080 on remote pc and its tunneled so u can view stuff in client.

ssh -p <PORT> <REMOTE_USER>@<REMOTE_IP> -L 8080:localhost:8080
@sheerun
sheerun / click.m
Last active September 29, 2019 11:19
Script for drawing on http://editfight.com/
// Compile with:
// gcc -o click click.m -framework ApplicationServices -framework Foundation
//
// Usage:
// ./click -x pixels -y pixels
// At the given coordinates it will click and release.
//
// From http://hints.macworld.com/article.php?story=2008051406323031
#import <Foundation/Foundation.h>
#import <ApplicationServices/ApplicationServices.h>
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
namespace WebApplication1
{
public class Program
{
public static void Main(string[] args)
@skeeto
skeeto / Makefile
Created January 17, 2018 20:16
r/dailyprogrammer Challenge #347 : Linear Feedback Shift Register
CFLAGS = -std=c99 -Wall -Wextra -O3 -g3
lfsr: lfsr.c
@freem
freem / twitter-killjunk.js
Last active December 28, 2022 22:22
disabling extraneous twitter features
/* NOTICE: THIS WAS MADE BACK IN 2017, OF COURSE IT'S NOT GOING TO WORK WELL NOW THAT TWITTER'S FUCKED THINGS UP */
@namespace url(http://www.w3.org/1999/xhtml);
@-moz-document domain("twitter.com") {
[data-component-context="suggest_recap"],
[data-component-context="suggest_who_to_follow"],
[data-component-context="suggest_activity"],
[data-component-context="suggest_activity_tweet"],
[data-component-context="suggest_recycled_tweet_inline"],
[data-component-context="suggest_recycled_tweet"]{
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@DDimitris
DDimitris / Cosine.rb
Created June 9, 2017 11:02
Cosine Similarity Ruby
class Cosine
def initialize vecA, vecB
@vecA = vecA
@vecB = vecB
end
def calculate_similarity
return nil unless @vecA.is_a? Array
return nil unless @vecB.is_a? Array
return nil if @vecA.size != @vecB.size
@yukimochi
yukimochi / Caddyfile.caddy1
Last active December 9, 2024 14:11
For Mastodon Caddy Setting file. (Based on official Nginx configuration example) [Last Update: Mar 07, 2021]
https://yourdomain.example.com/ {
log / /var/log/caddy/mastodon.log "{combined}" {
rotate_age 90
}
root /home/mastodon/live/public
gzip
header / {
Strict-Transport-Security "max-age=31536000"
}