Skip to content

Instantly share code, notes, and snippets.

View lululau's full-sized avatar
🎯
Focusing

FCP lululau

🎯
Focusing
  • Sunshine, Mountain East
View GitHub Profile
@lululau
lululau / dash-docgen.sh
Last active August 7, 2022 19:50
Add your home page of online docs to Dash.app
#!/bin/bash
if [ $# != 3 ]
then
cat <<EOF
Usage:
dash-docgen <doc name> <default keyword> <url>
EOF
else
DOC_NAME=$1
diff -Nur mituharu-emacs-mac-3ff676c2f98c/src/macappkit.m mituharu-emacs-mac-3ff676c2f98c-patched/src/macappkit.m
--- mituharu-emacs-mac-3ff676c2f98c/src/macappkit.m 2022-04-06 11:51:42.000000000 +0800
+++ mituharu-emacs-mac-3ff676c2f98c-patched/src/macappkit.m 2022-04-06 23:21:32.000000000 +0800
@@ -1935,6 +1935,17 @@
@implementation EmacsWindow
++ (NSButton *)standardWindowButton:(NSWindowButton)b forStyleMask:(NSWindowStyleMask)styleMask
+{
+ NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
diff --git a/src/macappkit.m b/src/macappkit.m
index fb7bf2a..732fbed 100644
--- a/src/macappkit.m
+++ b/src/macappkit.m
@@ -2262,6 +2262,18 @@ - (void)showMenuBar
@implementation EmacsWindow
++ (NSButton *)standardWindowButton:(NSWindowButton)b forStyleMask:(NSWindowStyleMask)styleMask
+{
# $HOME/.k9s/plugin.yml
plugin:
# run-stk:
# # Define a mnemonic to invoke the plugin
# shortCut: r
# # What will be shown on the K9s menu
# description: kubectl run lululau/stk
# # Collections of views that support this shortcut. (You can use `all`)
# scopes:
@lululau
lululau / ox-confluence.el
Created November 20, 2015 15:10
ox-confluence.el
;;; ox-confluence --- Confluence Wiki Back-End for Org Export Engine
;; Copyright (C) 2012, 2014 Sébastien Delafond
;; Author: Sébastien Delafond <sdelafond@gmail.com>
;; Keywords: outlines, confluence, wiki
;; This file is not part of GNU Emacs.
;; This program is free software: you can redistribute it and/or modify
@lululau
lululau / ruby-vs-java-python-rust.org
Created April 1, 2021 14:49
ruby-vs-java-python-rust

Range and Number

Collections

Enumerable

all?

Java

Stream.of(1, 2, 3, 4, 5).allMatch(x -> x < 10);

Python

@lululau
lululau / cookie2pie.rb
Created December 25, 2014 14:34
Convert cookie jar with cookie.txt format to HTTPie session file format
#!/usr/bin/env ruby
require 'json'
pie = {
"__meta__" => {
"about" => "HTTPie session file",
"help" => "https://github.com/jkbr/httpie#sessions",
"httpie" => "0.8.0"
},
ruby -i.bak -F, -ane '
p=$F[2].gsub(/省|市|自治区/, "");
c=$F[3].gsub(/市|自治./, "");
co=$F[4].gsub(/市|区|县|自治./, "");
$F[1]=$F[2]+$F[3]+$F[4]+$F[1].gsub(Regexp.new("^.*(%s|%s|%s)"%[$F[2],$F[3],$F[4]]), "").gsub(Regexp.new("^.*(%s|%s|%s)"%[p,c,co]), "");
$F[-1].chomp!
p1=$F[-3].gsub(/省|市|自治区/, "");
c1=$F[-2].gsub(/市|自治./, "");
#!/usr/bin/env zsh
for i in *.txt; do
echo '------------------------------------------------------'
base_name=${i%.txt}
contract_no=$(cat $i | iconv -c -f UTF-16LE | grep -o '合同 [0-9]*')
contract_no=${contract_no#* }
customer_name=$(cat $i | iconv -c -f UTF-16LE | grep -o '尊敬的 [^ ]*' )
customer_name=${customer_name#* }
customer_name=$(echo -n "$customer_name" | ruby -pe 'gsub(/[^\u4E00-\u9FA5]/, "?")')