Skip to content

Instantly share code, notes, and snippets.

@ypresto
ypresto / init.lua
Last active March 1, 2018 14:22
英数キーとかかなキーとかを同時押しの時だけAltキーにするHammerspoonの設定
local pressedKeyTable = {}
-- TODO: Consider about consumed per keys is necessary or not.
local consumed = false
local keyCodeTable = {}
keyCodeTable[0x66] = true -- EISUU
keyCodeTable[0x68] = true -- KANA
eventtap = hs.eventtap.new({ hs.eventtap.event.types.keyDown, hs.eventtap.event.types.keyUp }, function(event)
local keyCode = event:getKeyCode()
if keyCodeTable[keyCode] == true then
@neckhair
neckhair / .dockerignore
Created November 15, 2016 09:48
Sample dockerignore for a Rails app
.git
.gitignore
README.md
#
# OS X
#
.DS_Store
.AppleDouble
.LSOverride
@573
573 / readme.md
Last active October 30, 2022 12:48
mvn, how combine.children="append" combine.self="override" (default is "merge" for both) work in multimodule projects
  • the combine.* attributes belong to the configuration elements child elements but in the child not the parent pom
  • let's say we have a prepared configuration for some plugin build::pluginmanagement in the parent pom and the combine rules are applied to some more specific configuration of this plugin inside a profile in the child pom then we need to specify this profile in the mvn call to convince us: mvn -Ptheprofile -f thesubmodule/pom.xml help:effective-pom| less (use the search functionality / and n/SHIFT-n to navigate to the right occurrences)
  • IMHO the combine.children=append rule doesn't really make sense for configuration elements that have children of heterogeneous names, i. e. systemPropertyVariables, here the effect in case some entry already existed in the default configuration another one of the same name would be added i. e. you had <someEntrySays>this</someEntrySays> (from parent pom) and [...]combine...="append"[...]that (from child po
@hartfordfive
hartfordfive / verify_s3_file.rb
Created November 1, 2016 17:47
Check if file exists in S3 bucket with Ruby aws-sdk gem
require 'aws-sdk'
s3 = Aws::S3::Resource.new(
region: 'us-east-1',
credentials: Aws::InstanceProfileCredentials.new()
)
bucket = s3.bucket('my-daily-backups')
file = (DateTime.now).strftime("%Y.%m.%d-backup")
if bucket.object(file).exists?
@dhavaln
dhavaln / Setup & Install
Last active September 1, 2024 23:14
Setting up HAProxy on Mac OSX
Install HAProxy from Homebre:
`brew install haproxy`
For full reference:
https://serversforhackers.com/load-balancing-with-haproxy
import tornado.web
import tornado.httpserver
import os
class PageOneHandler(tornado.web.RequestHandler):
def get(self):
self.write(str(self.application.configs) + "\n")
def post(self):
@ttscoff
ttscoff / init.lua
Last active June 6, 2025 19:31
Hammerspoon config examples for hyper key
-- A global variable for the Hyper Mode
k = hs.hotkey.modal.new({}, "F17")
-- Trigger existing hyper key shortcuts
k:bind({}, 'm', nil, function() hs.eventtap.keyStroke({"cmd","alt","shift","ctrl"}, 'm') end)
-- OR build your own
launch = function(appname)

GoogleTest 在 CLion (JetBrains 的跨平台 C++ IDE) 中使用和配置


安装CLion

安装CLion很简单,流程和JetBrains的其他IDE基本是一样的,只是最后需要配置一下工具链。我使用的是Cygwin。

安装Cygwin

安装Cygwin的教程网上有很多,cmakemakegcc/clang, gdb/lldb这些是必须要安装的组件。

编译安装GoogleTest

打开Cygwin,找一个合适的位置,将GoogleTest的最新源码克隆到本地,然后进行编译和安装。

Here are my attempts to script an IntelliJ-based IDE.

IDE Scripting Console is backed by JSR-223 (javax.script.*) API.

Groovy, Clojure, JavaScript and other scripting languages may be used.

Open IDE Scripting Console, type a statement, hit Ctrl-Enter to execute the current line or selection.

.profile.language-extension file in the same directory will be executed along with it if present.

@Jeff2Ma
Jeff2Ma / alfred-json-format.sh
Created August 11, 2016 12:01
Alfred Script Filter JSON format
#
# Alfred Script Filter JSON format
#
# This example demonstrates all fields available for populating results.
#
# For an in-depth explanation, use the (?) help button to the bottom left.
#
cat << EOB
{"items": [