Skip to content

Instantly share code, notes, and snippets.

@gfreezy
gfreezy / .travis.yml
Created Aug 25, 2019
cache brew cache in travis
View .travis.yml
cache:
directories:
- $TRAVIS_BUILD_DIR/target
# https://stackoverflow.com/questions/39930171/cache-brew-builds-with-travis-ci
- $HOME/Library/Caches/Homebrew
- /usr/local/Homebrew/
# used in OSX custom build script dealing with local bottle caching
- $HOME/local_bottle_metadata
addons:
homebrew:
View main.rs
extern crate bitcask_rs;
extern crate actix_web;
extern crate actix;
extern crate failure;
extern crate futures;
use failure::{Fail, Error};
use futures::future::{Future, result};
use actix_web::{server, App, HttpRequest, Responder, FutureResponse, HttpResponse, AsyncResponder};
use std::path::PathBuf;
View board.proto
// Copyright 2015, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
View dump.py
class ImageDto(Model):
ident = StringType()
height = IntType()
width = IntType()
max_height = IntType()
max_width = IntType()
url_pattern = StringType()
View a.rs
impl ConnectionPool {
pub fn get_client<'a>(&'a self, addr: &str) -> Option<&'a rpc::Client> {
if let Some(&Ok(ref c)) = self.conns.get(addr) {
return Some(c);
}
let c = rpc::Client::new(addr);
self.conns.insert(addr.to_string(), c);
if let Some(&Ok(ref c)) = self.conns.get(addr) {
View test.py
import subprocess
path = '/mfs/test/%d.xlsx'
def write(file_path):
from xlsxwriter import Workbook
wb = Workbook(file_path)
st = wb.add_worksheet('test')
for i in range(10):
st.write(i, i, 'aa')
wb.close()
View gist:5daebd9ac2b916341891
#include "tlpi_hdr.h"
int
main(int argc, char *argv[])
{
printf("Hello world\n");
write(STDOUT_FILENO, "Ciao\n", 5);
if (fork() == -1)
errExit("fork");
/* Both child and parent continue execution here */
@gfreezy
gfreezy / encrypt.py
Created Sep 19, 2014
自动使用爱加密加密apk
View encrypt.py
#!/usr/bin/env python
import os
import requests
import time
import sys
from collections import namedtuple
LOGIN_PATH = 'http://www.ijiami.cn/toLogin'
UPLOAD_PATH = 'http://www.ijiami.cn/upload/'
@gfreezy
gfreezy / gocd.plugin.zsh
Created Sep 13, 2014
zsh plugin for go
View gocd.plugin.zsh
function gorun() {
$GOPATH/bin/$1
}
function gosrc() {
cd $GOPATH/src/${1:-/github.com/gfreezy}
}
function gopkg() {
cd $GOPATH/pkg/${1:-darwin_amd64/github.com/gfreezy}
@gfreezy
gfreezy / mfschunkserver
Last active Aug 29, 2015
moosefs init.d
View mfschunkserver
#!/bin/sh -e
# ============================================
# mfschunkserver - Starts the Moosefs chunkserver daemon.
# ============================================
#
# :Usage: /etc/init.d/mfschunkserver {start|stop|reload|restart|test|status}
#
### BEGIN INIT INFO