Skip to content

Instantly share code, notes, and snippets.

@programus
programus / impbcopy.m
Last active November 7, 2022 09:02 — forked from yuchuanfeng/impbcopy.m
Command line copy an image file to the clipboard in Mac OS X. See first comment for install instructions.
#import <Foundation/Foundation.h>
#import <Cocoa/Cocoa.h>
#import <unistd.h>
BOOL copy_to_clipboard(NSString *path)
{
// http://stackoverflow.com/questions/2681630/how-to-read-png-image-to-nsimage
NSImage * image;
if([path isEqualToString:@"-"])
{
// http://caiustheory.com/read-standard-input-using-objective-c
@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 = () => {
-- 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 / 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
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@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
@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 / 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 / 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 / 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 "****************************"