Skip to content

Instantly share code, notes, and snippets.

@Ilgrim
Ilgrim / socket_chat.py
Created Aug 29, 2021 — forked from owainlewis/socket_chat.py
Python socket based chat server
View socket_chat.py
#!/usr/bin/python3
import socket, sys, threading
# Simple chat client that allows multiple connections via threads
PORT = 9876 # the port number to run our server on
__version__ = "0.0.1"
class ChatServer(threading.Thread):
@Ilgrim
Ilgrim / EchoClient.java
Created Jul 20, 2021 — forked from ochinchina/EchoClient.java
Async socket demo in java
View EchoClient.java
package asyncsocket;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.AsynchronousSocketChannel;
import java.nio.channels.CompletionHandler;
import java.util.concurrent.atomic.AtomicInteger;
@Ilgrim
Ilgrim / postura.py
Created Jul 2, 2021 — forked from serxoz/postura.py
Aviso para mellorar a postura sentado
View postura.py
#!/usr/bin/env python
"""
Aviso para que me recorde que me sente ben.
crontab:
0,20,40 * * * * DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus XDG_RUNTIME_DIR="/run/user/1000" ~/bin/postura.py
NOTA: axustar as variables de sesión co UID do teu usuario.
"""
View msys2-SDL2-Setup.md

Download and install msys2 64bit

Update msys2

  • Update msys2 64bit after install by running pacman -Syu if pacman needs to be updated you might have to close and reopen the terminal and run pacman -Syu again

Install build tools

  • pacman -S git mingw-w64-x86_64-toolchain mingw64/mingw-w64-x86_64-SDL2 mingw64/mingw-w64-x86_64-SDL2_mixer mingw64/mingw-w64-x86_64-SDL2_image mingw64/mingw-w64-x86_64-SDL2_ttf mingw64/mingw-w64-x86_64-SDL2_net mingw64/mingw-w64-x86_64-cmake make

Compile Hello World

@Ilgrim
Ilgrim / utf8.c
Last active Jun 19, 2021 — forked from stanislaw/utf8.c
Some C functions to work with UTF-8 string : you can check if a string is valid UTF-8, get the length of a UTF-8 string and replace things in a UTF-8 string. All `char *` arguments must be regular, null-byte terminated, C strings. I've tried to optimize the best I could. I'd be grateful for any suggestions or improvements. Please note I have onl…
View utf8.c
//
// utf8.c
// training
//
// Created by Conrad Kleinespel on 5/27/13.
// Copyright (c) 2013 Conrad Kleinespel. All rights reserved.
//
#include <stdio.h>
#include <stdlib.h>
@Ilgrim
Ilgrim / InstallingMeld
Created Apr 28, 2021 — forked from kjlubick/InstallingMeld
How to install Meld on Windows and getting it set up with Git
View InstallingMeld
After installing it http://sourceforge.net/projects/meld-installer/
I had to tell git where it was:
git config --global merge.tool meld
git config --global diff.tool meld
git config --global mergetool.meld.path “C:\Program Files (x86)\Meld\meld\meld.exe”
And that seems to work. Both merging and diffing with “git difftool” or “git mergetool”
View gist:b899aedfdda944e67d686a627f242519
# first, fetch the latest refs for all branches. And be sure we have latest master, etc
git checkout master
git fetch
# If any changes from remote, catch our local version up
git rebase origin/master
# could also be done as
@Ilgrim
Ilgrim / amstrad_cpc.md
Created Apr 27, 2021 — forked from neuro-sys/amstrad_cpc.md
Amstrad CPC 464/6128 Programming Resources
View amstrad_cpc.md

Amstrad CPC 464/6128 Programming Resources

A collection of information gathered from various resources into a single document to be able to program for Amstrad CPC 464/6128 machines.

Hardware

CPC has the following components on the mainboard:

@Ilgrim
Ilgrim / wget.sh
Created Feb 8, 2021 — forked from mikecrittenden/wget.sh
Download an entire website with wget, along with assets.
View wget.sh
# One liner
wget --recursive --page-requisites --adjust-extension --span-hosts --convert-links --restrict-file-names=windows --domains yoursite.com --no-parent yoursite.com
# Explained
wget \
--recursive \ # Download the whole site.
--page-requisites \ # Get all assets/elements (CSS/JS/images).
--adjust-extension \ # Save files with .html on the end.
--span-hosts \ # Include necessary assets from offsite as well.
--convert-links \ # Update links to still work in the static version.
@Ilgrim
Ilgrim / client.py
Created Feb 2, 2021 — forked from dbehnke/client.py
Python AsyncIO Client and Server Example using StreamReader and StreamWriter
View client.py
"""
client.py - AsyncIO Server using StreamReader and StreamWriter
This will create 200 client connections to a server running server.py
It will handshake and run similar to this:
Server: HELLO
Client: WORLD