Skip to content

Instantly share code, notes, and snippets.

View Aufree's full-sized avatar
:octocat:
>(0.0)<

Aufree Aufree

:octocat:
>(0.0)<
  • Freelancer
  • ShenZhen, China
View GitHub Profile
@Aufree
Aufree / install-release.sh
Created October 20, 2017 09:25
Auto install V2Ray
#!/bin/bash
# This file is accessible as https://install.direct/go.sh
# Original source is located at github.com/v2ray/v2ray-core/release/install-release.sh
CUR_VER=""
NEW_VER=""
ARCH=""
VDIS="64"
ZIPFILE="/tmp/v2ray/v2ray.zip"
@Aufree
Aufree / bbr.sh
Created October 20, 2017 08:59
Auto install latest kernel for TCP BBR
#!/usr/bin/env bash
#
# Auto install latest kernel for TCP BBR
#
# System Required: CentOS 6+, Debian7+, Ubuntu12+
#
# Copyright (C) 2016-2017 Teddysun <i@teddysun.com>
#
# URL: https://teddysun.com/489.html
#
#!/usr/bin/bash
while read repo
do curl -X DELETE -H "Authorization: token GITHUB_TOKEN" "https://api.github.com/repos/$repo"
done < repos.txt
/*
* NOTE:
* - The use of browser-specific styles (-moz-, -webkit-) should be avoided.
* If used, they may not render correctly for people reading the email in
* a different browser than the one from which the email was sent.
* - The use of state-dependent styles (like a:hover) don't work because they
* don't match at the time the styles are made explicit. (In email, styles
* must be explicitly applied to all elements -- stylesheets get stripped.)
*/
@Aufree
Aufree / keymap.cson
Last active August 14, 2016 01:25
Backup atom keymap.cson file
# Beautify shortcut
'atom-text-editor':
'shift-cmd-h': 'atom-beautify:beautify-editor'
# Alignment shortcut
'.platform-darwin atom-text-editor':
'ctrl-cmd-t': 'atom-alignment:alignMultiple'
# Will make autocomplete trigger with 'enter' instead of 'tab'
'atom-text-editor:not(mini) .autocomplete-plus.autocomplete-suggestion-list':
@Aufree
Aufree / DidSelectTabBar.m
Created October 27, 2015 02:43
Did select tababr
- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController {
id nc = viewController;
id vc = [[nc viewControllers] objectAtIndex:0];
static UIViewController *previousController = nil;
if (previousController == viewController) {
if ([vc isKindOfClass:[TopicListViewController class]]) {
}
}
@implementation ViewController
- (void)viewDidLoad{
_showCoverImage.contentMode = UIViewContentModeScaleAspectFit;
_showCoverImage.image = [self imageWithBlurredImageWithImage:_showCoverImage.image andBlurInsetFromBottom: 200 withBlurRadius:3];
}
- (UIImage*)imageWithBlurredImageWithImage:(UIImage*)image andBlurInsetFromBottom:(CGFloat)bottom withBlurRadius:(CGFloat)blurRadius{
UIGraphicsBeginImageContext(image.size);
CGContextRef context = UIGraphicsGetCurrentContext();
@Aufree
Aufree / Fuck_GitHub_New_NavigationBar.html
Last active August 29, 2015 14:22
Fuck GitHub New NavigationBar
<div class="header header-logged-in true" role="banner">
<div class="container clearfix">
<a class="header-logo-invertocat" href="https://github.com/" data-hotkey="g d" aria-label="Homepage" data-ga-click="Header, go to dashboard, icon:logo">
<span class="mega-octicon octicon-mark-github"></span>
</a>
<div class="site-search repo-scope js-site-search" role="search">
<form accept-charset="UTF-8" action="/" class="js-site-search-form" data-global-search-url="/search" data-repo-search-url="/" method="get"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓"></div>
@Aufree
Aufree / awesomeGif.sh
Last active August 29, 2015 14:20
利用 QuickTime Player 和 FFmpeg 生成高质量的 Gif 图
palette="./palette.png"
filters="fps=30,scale=320:-1:flags=lanczos"
ffmpeg -v warning -i $1 -vf "$filters,palettegen" -y $palette
ffmpeg -v warning -i $1 -i $palette -lavfi "$filters [x]; [x][1:v] paletteuse" -y $2
# palette.png 可以从这里下载: http://ww4.sinaimg.cn/large/76dc7f1bgw1erny806ga9j200g00g0jo.jpg 请改名为 palette.png
# fps 越高越流畅, 但体积会越大
# 使用方法, 运行: ./awesomeGif.sh welcome.mov welcome.gif
@Aufree
Aufree / NSString_Filter_Emoji
Created March 5, 2015 03:17
Filter all emoji from nsstring
- (NSString*)removeEmoji:(NSString *)username {
__block NSMutableString* temp = [NSMutableString string];
[username enumerateSubstringsInRange:NSMakeRange(0, [username length]) options:NSStringEnumerationByComposedCharacterSequences usingBlock:
^(NSString *substring, NSRange substringRange, NSRange enclosingRange, BOOL *stop) {
const unichar hs = [substring characterAtIndex: 0];
// surrogate pair
if (0xd800 <= hs && hs <= 0xdbff) {