Skip to content

Instantly share code, notes, and snippets.

View oa414's full-sized avatar
🤓
苟利国家生死以,岂因祸福避趋之

Lin Xiangyu oa414

🤓
苟利国家生死以,岂因祸福避趋之
View GitHub Profile
@oa414
oa414 / ByeZhihuSecurity.js
Last active November 10, 2021 08:05
去除知乎点开外链的安全中心跳转
// ==UserScript==
// @name ByeZhihuSecurity
// @namespace http://tampermonkey.net/
// @version 0.1
// @description 去除知乎点开外链的安全中心跳转
// @author Lin Xiangyu
// @match https://www.zhihu.com/*
// @grant none
// ==/UserScript==
# Install Mosh and other software
yum -y update
yum groupinstall -y 'development tools'
yum -y install git vim curl screen nodejs mosh zsh nginx
yum install epel-release -y
#yum -y install mosh
sudo iptables -I INPUT 1 -p udp --dport 60000:61000 -j ACCEPT
@oa414
oa414 / vncservers
Last active November 6, 2015 09:05
/etc/sysconfig/vncservers
VNCSERVERS="1:root"
VNCSERVERARGS[1]="-geometry 800x600"
require 'git'
# 一个计算在项目中 coding 时间的 Ruby 脚本,适用于频繁提交 commit 的个人项目。目前局限性还很大。
# 扫描 Git 的 Log,对于两个时间间隔短的 commit 那么判定这个时间段在 coding,统计的总时间会略少一点。
# 具体如何判定间隔可以修改 judge 函数。
# 使用:
@oa414
oa414 / initNavBarWithColor.m
Created August 7, 2014 01:40
initNavBarWithColor
+(void)initNavBarWithColor:(UINavigationBar *) navigationBar color:(NSUInteger )hexColor title:(NSString *)title{
navigationBar.barTintColor = UIColorFromRGB(hexColor);
navigationBar.tintColor = [UIColor whiteColor];
[navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor whiteColor]}];
navigationBar.translucent = YES;
navigationBar.topItem.title = title;
}
#import <UIKit/UIKit.h>
@interface SXTimeScopePicker : UIPickerView<UIPickerViewDataSource, UIPickerViewDelegate>
@property NSString *currentText;
@property NSArray *data;
@property UITextField *textField;
//
// SXStoregeHelper.h
// sx
//
// Created by xiangyu on 3/26/14.
// Copyright (c) 2014 xiangyu. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "DefaultsKeys.h"
//
// SXHTTPHelper.h
// sx
//
// Created by xiangyu on 4/1/14.
// Copyright (c) 2014 xiangyu. All rights reserved.
//
#import <Foundation/Foundation.h>
@oa414
oa414 / DumpiOSSDKHeader.pl
Created August 6, 2014 02:18
导出iOS SDK头文件
#!/usr/bin/perl
#
# 24 November 2008
# Framework Dumping utility; requires class-dump
# 2014.8.3 modify by Lin Xiangyu <lxyweb@gmail.com> to fit iOS 7.1 SDK
use strict;
use Cwd;
use File::Path;
@oa414
oa414 / resize_icon.rb
Created August 3, 2014 06:17
generate icon in different size
[1024, 512, 256, 128 ,100, 64, 50, 26 ,24].each do |i|
n = i.to_s
`convert raw.png -resize #{n}x#{n}! #{n}.png`
end