Skip to content

Instantly share code, notes, and snippets.

@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
@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 / JsonUtilities.cs
Created April 1, 2012 12:50
Functions to convert string(utf-8 in c++) to \uXXXX unicode escape
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Text;
namespace CIS_StdWebServices.Utils
{
public class JsonUtilities
{
-- 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 = () => {
@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 / 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 / data-table.css
Created March 7, 2012 13:12
CSS & head to set data table format in Octopress
* + table {
border-style:solid;
border-width:1px;
border-color:#e7e3e7;
}
* + table th, * + table td {
border-style:dashed;
border-width:1px;
border-color:#e7e3e7;
import java.util.Random;
public class StringBufferVsStringBuilder {
public static int demo(final Object stringJoiner, final int testCount) throws InterruptedException {
ThreadGroup group = new ThreadGroup(stringJoiner.getClass().getName() + "@" + stringJoiner.hashCode());
final Random rand = new Random();
Runnable listAppender = new Runnable() {
public void run() {
try {