Skip to content

Instantly share code, notes, and snippets.

@gfreezy
gfreezy / mfschunkserver
Last active August 29, 2015 14:01
moosefs init.d
#!/bin/sh -e
# ============================================
# mfschunkserver - Starts the Moosefs chunkserver daemon.
# ============================================
#
# :Usage: /etc/init.d/mfschunkserver {start|stop|reload|restart|test|status}
#
### BEGIN INIT INFO
@gfreezy
gfreezy / gocd.plugin.zsh
Created September 13, 2014 14:12
zsh plugin for go
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 / encrypt.py
Created September 19, 2014 07:22
自动使用爱加密加密apk
#!/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/'
#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 / test.py
Last active October 20, 2016 14:12
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()
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) {
class ImageDto(Model):
ident = StringType()
height = IntType()
width = IntType()
max_height = IntType()
max_width = IntType()
url_pattern = StringType()
// 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
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;
@gfreezy
gfreezy / .travis.yml
Created August 25, 2019 07:34
cache brew cache in travis
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: