Skip to content

Instantly share code, notes, and snippets.

View Magicloud's full-sized avatar
🏠
Writing GUI is exhausting and frustrating.

王世达 Magicloud

🏠
Writing GUI is exhausting and frustrating.
  • Meishan, Sichuan, China
View GitHub Profile
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
];
nix.settings.max-jobs = 24;
nix.settings.cores = 24;
# boot.kernelModules = [ "kvm-amd" "kvm-intel" ];
@Magicloud
Magicloud / init
Created September 21, 2020 20:37
A systemd replacement for ArchLinux XFCE in container
#!/bin/bash
export LC_ALL=en_US.UTF-8
rm -f /run/dbus/pid
rm -f /var/run/xrdp-sesman.pid
rm -f /var/run/xrdp.pid
dbus-daemon --system
xrdp-sesman
xrdp
#!/usr/bin/python3
from http.server import HTTPServer, BaseHTTPRequestHandler
import socket
class SimpleHTTPRequestHandler(BaseHTTPRequestHandler):
def do_GET(self):
self.send_response(200)
self.send_header("Content-Type", "text/html")
self.end_headers()
#!/usr/bin/python3
import socket
import sys
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server_address = ('0.0.0.0', 10000)
sock.bind(server_address)
sock.listen(1)
@Magicloud
Magicloud / isrs.hs
Created November 18, 2019 20:03
Invertible syntax Read/Show.
-- Copied from https://www.howtobuildsoftware.com/index.php/how-do/fWl/haskell-template-haskell-deriving-custom-derivingreadshow-for-enum-type
import Prelude hiding (Applicative(..), print)
import Data.Maybe (fromJust)
import Text.Syntax
import Text.Syntax.Parser.Naive
import Text.Syntax.Printer.Naive
data TVShow = BobsBurgers | MrRobot | BatmanTAS deriving (Eq, Ord)
[alias]
lg1 = log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(black)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
lg2 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(black)%s%C(reset) %C(dim white)- %an%C(reset)' --all
lg = !"git lg1"
@Magicloud
Magicloud / https.py
Created August 17, 2019 11:15
Basic HTTPS service
#!/usr/bin/python3
from http.server import HTTPServer, BaseHTTPRequestHandler
import ssl
import socket
class SimpleHTTPRequestHandler(BaseHTTPRequestHandler):
def do_GET(self):
self.send_response(200)
self.send_header("Content-Type", "text/html")

Keybase proof

I hereby claim:

  • I am magicloud on github.
  • I am shida (https://keybase.io/shida) on keybase.
  • I have a public key ASD2Is-j15NGhteTJ_jPU0vvHOi5HfKgu-QQpiAYcVKHfwo

To claim this, I am signing this object: