Skip to content

Instantly share code, notes, and snippets.

@programus
programus / guess.sh
Last active August 29, 2015 14:04
guess number game in shell script
#!/bin/sh
# 猜数字游戏Shell版程序
function generateGoal()
{ # 生成被猜数字
# 准备一个包含0-9的池
local pool=($(seq 0 9))
for i in $(seq 0 3)
do
@programus
programus / planes.sh
Created August 3, 2014 15:43
Hit plane game in shell script
#!/bin/sh
HIT="X"
BLANK="."
function printBanner()
{
echo "****************************"
echo "* PLANE *"
echo "****************************"
@programus
programus / mine.sh
Last active August 29, 2015 14:04
mine sweeper shell version
#!/bin/bash
MINE="@"
BOOM="X"
BLANK=" "
NEW="."
MARK="M"
OPEN_FLAG=1
MARK_FLAG=2
@programus
programus / from.html
Last active August 29, 2015 14:27
close popup after changed html
<!DOCTYPE html>
<html lang="ja-JP">
<head>
<title>From</title>
<meta charset="UTF-8">
</head>
<body onload="document.getElementById('closed-flg').checked = true;">
<input type="checkbox" id="closed-flg"/>
<a href="#" onclick="window.open('popup.html', 'popup'); document.getElementById('closed-flg').checked = false; ">popup</a>
<a href="#" id="link-to" onclick="window.location.href='to.html' + (document.getElementById('closed-flg') ? '' : '?popup');">To</a>
@programus
programus / tcpclient.go
Last active August 30, 2019 10:52
go tcp server/client
package main
import (
"fmt"
"os"
"os/signal"
"syscall"
"net"
"io"
"time"
@programus
programus / README-cdx.md
Last active October 15, 2020 06:59
Extended windows cd command

CDX Command - CD eXtension batch file

This is a batch file could help you change working directory easier especially you need to change many directories very often like me.

Features

  • Save histroy of all navigated directories
  • No duplicated directories in histroy
  • Name history directories
  • Jump into any directory in histroy by index or name
  • Quich jump into previous directory
  • Maintain history list
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@programus
programus / alacritty.yml
Last active February 13, 2024 22:14
pull down from top alacritty (like iTerm2)
window:
# Window dimensions (changes require restart)
#
# Number of lines/columns (not pixels) in the terminal. The number of columns
# must be at least `2`, while using a value of `0` for columns and lines will
# fall back to the window manager's recommended size.
dimensions:
columns: 500
lines: 30
-- Switch kitty
hs.hotkey.bind({'alt'}, 'space', function ()
local APP_NAME = 'kitty'
function moveWindow(app, space, mainScreen)
-- move to main space
print('move window')
local win = nil
while win == nil do
win = app:mainWindow()
@programus
programus / ajaxPool.js
Last active October 8, 2021 07:40 — forked from Terrance/AjaxQueue.js
Limit concurrent jQuery ajax requests to at most 6 at a time, and queue the rest.
const ajaxPool = {
queue: [],
reqCount: 0,
activeCount: 0,
maxCount: parseInt(searchParams.get('ajaxLimit')) || 6,
add(obj) {
this.reqCount++
const originalSuccess = obj.success
const originalError = obj.error
const callback = () => {