This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <cairo/cairo.h> | |
#include <cairo/cairo-quartz.h> | |
int main(int argc, const char * argv[]) { | |
cairo_surface_t *surface = cairo_quartz_surface_create(CAIRO_FORMAT_RGB24, 320 * 3.0, 560 * 3.0); | |
cairo_t *cr = cairo_create(surface); | |
cairo_set_antialias(cr, CAIRO_ANTIALIAS_BEST); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
arch_name="$(uname -m)" | |
if [ "${arch_name}" = "x86_64" ]; then | |
if [ "$(sysctl -in sysctl.proc_translated)" = "1" ]; then | |
echo "Running on Rosetta 2" | |
else | |
echo "Running on native Intel" | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. | |
; #Warn ; Enable warnings to assist with detecting common errors. | |
SendMode Input ; Recommended for new scripts due to its superior speed and reliability. | |
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. | |
SourceFile = %A_ScriptDir%\shortcuts.ahk | |
DestFile = %A_Startup%\shortcuts.ahk | |
FileCopy, %SourceFile%, %DestFile%, true | |
Run, %A_Startup% |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. | |
; #Warn ; Enable warnings to assist with detecting common errors. | |
SendMode Input ; Recommended for new scripts due to its superior speed and reliability. | |
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. | |
SetCapsLockState, AlwaysOff | |
+!m::SendInput +^m | |
!s::SendInput ^s | |
!a::SendInput ^a |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require "date" | |
class Date | |
def weekday | |
case self.wday | |
when 0 then "日" | |
when 1 then "一" | |
when 2 then "二" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set -g prefix C-g | |
setw -g mode-keys vi | |
unbind C-b | |
bind C-g send-prefix | |
bind -n C-\ split-window -h | |
bind -n C-M-\ split-window | |
bind -n F1 list-keys |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)drawRect:(CGRect)rect | |
{ | |
if (!self.image) { | |
CGContextRef context = UIGraphicsGetCurrentContext(); | |
CGContextSetFillColorWithColor(context, self.backgroundColor.CGColor); | |
CGContextFillRect(context, rect); | |
return; | |
} | |
CGFloat w = CGRectGetWidth(self.frame); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: UTF-8 -*- | |
import zipfile | |
import biplist | |
import tempfile | |
import shutil | |
import re | |
import os | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
/* | |
* 基姆拉尔森计算公式 | |
* W= (d+2*m+3*(m+1)/5+y+y/4-y/100+y/400) mod 7 | |
*/ | |
int week(int y, int m, int d) | |
{ | |
if (m < 3) { | |
m += 12; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
str = ARGF.argv[0].strip.downcase | |
if str.start_with? '0x' | |
str.delete! '0x' | |
end | |
str.each_char do |c| | |
bin = c.to_i(16).to_s(2) | |
bin.insert(0, '0' * (4-bin.length)) if bin.length < 4 |