View AutoHotKey.ahk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. | |
SendMode Input ; Recommended for new scripts due to its superior speed and reliability. | |
#Persistent ; Keeps a script permanently running (that is, until the user closes it or ExitApp is encountered). | |
; Globals | |
DesktopCount = 2 ; Windows starts with 2 desktops at boot | |
CurrentDesktop = 1 ; Desktop count is 1-indexed (Microsoft numbers them this way) | |
; DLL |
View win_api_test.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# _*_ coding:utf-8 _*_ | |
import ctypes | |
import os | |
from ctypes import windll, wintypes | |
from typing import Optional | |
NULL: int = 0 |
View commands.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# check status | |
sudo ufw status | |
# deny all incoming | |
sudo ufw default deny incoming | |
# allow from a specific source IP address or entire subnet to connect to our port 22 | |
sudo ufw allow from 192.168.1.0/24 to any port 22 proto tcp | |
# enable the ufw | |
sudo ufw enable |
View convert.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
trap cleanup EXIT | |
set -eux | |
set -o pipefail | |
SWFFILE="$1" | |
MP4FILE="${SWFFILE%.*}.mp4" | |
RAWFILE=$(cat /dev/urandom | tr -dc 'a-zA-Z' | fold -w 32 | head -n 1).raw | |
WAVFILE=$(cat /dev/urandom | tr -dc 'a-zA-Z' | fold -w 32 | head -n 1).wav |
View game.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- coding:utf-8 -*- | |
"""An easy action adventure game based on text.""" | |
import random | |
import time | |
import uuid | |
from typing import Dict, Generator, List, Protocol |
View 24-game.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- coding:utf-8 -*- | |
import itertools | |
from typing import Optional | |
from expression import Expr | |
from fraction import Frac |
View value.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::collections::HashMap; | |
use std::fmt; | |
use std::ops::Add; | |
use std::sync::Arc; | |
struct Procedure { | |
name: String, | |
inner_proc: Arc<dyn Fn(Vec<Value>) -> Value>, | |
} |
View stream.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
def cons_stream(head, tail): | |
return (head, delay(tail)) | |
def head(s): | |
return s[0] | |
View query.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- coding:utf-8 -*- | |
import mmap | |
import struct | |
import socket | |
import pathlib | |
from typing import Tuple |
View number.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# _*_ coding:utf-8 _*_ | |
import re | |
def str_to_int(s: str) -> int: | |
if not s: | |
return 0 | |
i = ord(s[0]) - ord("0") |
NewerOlder