Skip to content

Instantly share code, notes, and snippets.

View astrolemonade's full-sized avatar
🔍
Happiness should be a pure function without any parameters.

astrolemonade astrolemonade

🔍
Happiness should be a pure function without any parameters.
View GitHub Profile
@astrolemonade
astrolemonade / main.rb
Created June 11, 2020 14:29 — forked from amirrajan/main.rb
Tic Tac Toe Written in DragonRuby Game Toolkit
#This sample app is a classic game of Tic Tac Toe.
class TicTacToe
attr_accessor :_, :state, :outputs, :inputs, :grid, :gtk
#Starts the game with player x's turn and creates an array for space combinations.
#Calls methods necessary for the game to run properly.
def tick
state.current_turn ||= :x
state.space_combinations = [-1, 0, 1].product([-1, 0, 1]).to_a
@astrolemonade
astrolemonade / FarGit.psm1
Created July 7, 2020 18:42 — forked from nightroman/FarGit.psm1
Interactive Git commands for Far Manager + FarNet.PowerShellFar
<#
Interactive Git commands for Far Manager + FarNet.PowerShellFar
<https://gist.github.com/nightroman/1d4806e4bcd2fae1b852>
HOW TO USE
Create a directory FarGit in any of $env:PSModulePath. As far as it is for
PowerShellFar only consider %FARHOME%\FarNet\Modules\PowerShellFar\Modules
Download FarGit.psm1 to the created directory FarGit.
@astrolemonade
astrolemonade / fix-infinality.md
Created July 15, 2020 21:46 — forked from cryzed/fix-infinality.md
A set of instructions on how to fix the harfbuzz + Infinality issue and restoring good-looking, Infinality-like font rendering.

Disclaimer: Please follow this guide being aware of the fact that I'm not an expert regarding the things outlined below, however I made my best attempt. A few people in IRC confirmed it worked for them and the results looked acceptable.

Attention: After following all the steps run gdk-pixbuf-query-loaders --update-cache as root, this prevents various gdk-related bugs that have been reported in the last few hours. Symptoms are varied, and for Cinnamon the DE fails to start entirely while for XFCE the icon theme seemingly can't be changed anymore etc.

Check the gist's comments for any further tips and instructions, especially if you are running into problems!

Screenshots

Results after following the guide as of 11.01.2017 13:08:

@astrolemonade
astrolemonade / inherit.rs
Created July 26, 2020 20:55 — forked from kyleheadley/inherit.rs
A model for trait-based inheritance in Rust
//! Demo of static "inheritance"
//!
//! Use trait objects to get dynamic inheritance,
//! but casting to a subtype is not explored here
////////////////////////////////////////////////////////
// Define Base type, interface, and what is overloadable
////////////////////////////////////////////////////////
/// The main type that will be extended
@astrolemonade
astrolemonade / gist:1d0a0e309abffa219eab1c34c9e4de42
Created August 3, 2020 07:33 — forked from szydan/gist:b225749445b3602083ed
<U+FEFF> character showing up in files. How to remove them?
1) In your terminal, open the file using vim:
vim file_name
2) Remove all BOM characters:
:set nobomb
3) Save the file:
:wq
@astrolemonade
astrolemonade / colourfy_Black_and_White.pde
Created August 4, 2020 07:51 — forked from volfegan/colourfy_Black_and_White.pde
Gradually puts colour on Black and White images
//tweet size: https://twitter.com/VolfeganGeist/status/1290397301522010112
float t=0;
PImage img;
PImage back_white; //image processed
String filename;
void keyPressed() {
if (keyPressed) {
if (key == 'r' || key == 'R') {
println("r");
local ffi = require('ffi')
--local lib = ffi.load('libraylib.2.0.0.dylib')
local lib = ffi.load('libraylib')
ffi.cdef[[
// Vector2 type
typedef struct Vector2 {
float x;
float y;
} Vector2;
@astrolemonade
astrolemonade / export-svg-inkscape.md
Created September 7, 2020 20:07 — forked from brenopolanski/export-svg-inkscape.md
Exporting an object as svg from inkscape
  1. Select the object(s) to export
  2. Open the document properties window (Ctrl+Shift+D)
  3. Select "Resize page to drawing or selection"
  4. File > Save As Copy...
  5. Select Optimized SVG as the format if you want to use it on the web
@astrolemonade
astrolemonade / resources.md
Created September 10, 2020 09:26 — forked from fffaraz/resources.md
CS 306 - Linux/UNIX Programming
@astrolemonade
astrolemonade / server.c
Created September 10, 2020 21:43
Simple FTP Server - Socket programming in C
/*
* server.c
*
* Simple FTP Server
* ====================
* If the client connects to the server and wants to retrieve a file
* with command "Get FILENAME", server retrieves iff the file exists
* on the server o/w notifies the client with an error message.
*
* Compile & link : gcc server.c -lpthread -o server