Skip to content

Instantly share code, notes, and snippets.

@guanqun
guanqun / code-review
Created May 20, 2016 15:15 — forked from evant/code-review
A ruby script to automatically create crucible reviews based on your current branch and youtrack ticket.
#!/usr/bin/env ruby
# A script to create a review on crucible based on the current git branch and
# youtrack ticket.
#
# To configure settings, create a file named .code-review in your home directory
# The format should be:
# ------------------------------------------------------------------------------
# crucible:
# url: <crucible url>
# username: <username>
@guanqun
guanqun / send_fd.txt
Created January 21, 2016 11:49
send fd to another process
http://stackoverflow.com/questions/8481138/how-to-use-sendmsg-to-send-a-file-descriptor-via-sockets-between-2-processes
http://stackoverflow.com/questions/1997622/can-i-open-a-socket-and-pass-it-to-another-process-in-linux
http://www.normalesup.org/~george/comp/libancillary/
http://man7.org/tlpi/code/online/dist/sockets/scm_rights_send.c.html
@guanqun
guanqun / tshark.sh
Last active February 3, 2016 01:20
manipulate pcap with tshark: dump its udp port
/usr/bin/tshark -r some.cap.gz -T fields -e ip.dst -e udp.port -R "udp" > output.txt
/usr/bin/tshark -R ip.addr==1.1.1.1 -r test.pcap -w testout.pcap
@guanqun
guanqun / note.sh
Created January 18, 2016 07:16
new way to install llvm libc++ in Ubuntu 14.04 Trusty
# http://llvm.org/apt/
sudo bash -c "cat >> /etc/apt/sources.list" << LLVMAPT
# LLVM
deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty main
deb-src http://llvm.org/apt/trusty/ llvm-toolchain-trusty main
# 3.6
deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty-3.6 main
deb-src http://llvm.org/apt/trusty/ llvm-toolchain-trusty-3.6 main
# 3.7
public static function firstByName($name)
{
$instance = static::firstByAttributes(array('user_id' => $name));
return $instance ?: null;
}
From 1b2359182660a7e5907311510cdd1e0eee45b3fe Mon Sep 17 00:00:00 2001
From: Rolando Abarca <m@rolando.cl>
Date: Thu, 25 Oct 2012 14:19:51 -0700
Subject: [PATCH] squashed commits
---
.gitignore | 2 +
js/src/aclocal.m4 | 1 +
js/src/build-ios/build_ios_static_fat.sh | 55 ++++++++++++++++++
js/src/build/autoconf/ios.m4 | 95 ++++++++++++++++++++++++++++++++
###
$ cat build-ios/build_ios_fat.sh
#!/bin/sh
# build.sh
IOS_BASE_SDK="5.1"
IOS_DEPLOY_TGT="5.0"
../configure --target=arm-apple-darwin10 --with-ios-
target=iPhoneSimulator --disable-shared-js --disable-tests --enable-
@guanqun
guanqun / gist:8134605
Last active January 1, 2016 10:59
about lightining
http://blog.hmark.eu/2013/03/08/2d-lightning-effect-in-starling/
http://nullcandy.com/particle-text-in-xna-and-javascript/
http://gamedevelopment.tutsplus.com/tutorials/how-to-generate-shockingly-good-2d-lightning-effects--gamedev-2681
@guanqun
guanqun / exit.mm
Created December 25, 2013 14:28
quit ios app with animation
- (void)exitApplication {
[UIView beginAnimations:@"exitApplication" context:nil];
[UIView setAnimationDuration:0.5];
[UIView setAnimationDelegate:self];
[UIView setAnimationTransition:UIViewAnimationCurveEaseOut forView:self.window cache:NO];
[UIView setAnimationDidStopSelector:@selector(animationFinished:finished:context:)];
self.window.bounds = CGRectMake(0, 0, 0, 0);
[UIView commitAnimations];
}
- (void)animationFinished:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context {
#include <algorithm>
#include <functional>
#include <cctype>
#include <locale>
// trim from start
static inline std::string &ltrim(std::string &s) {
s.erase(s.begin(), std::find_if(s.begin(), s.end(), std::not1(std::ptr_fun<int, int>(std::isspace))));
return s;
}