Skip to content

Instantly share code, notes, and snippets.

View lostsnow's full-sized avatar
👻
nil

lostsnow lostsnow

👻
nil
View GitHub Profile
#!/bin/sh
#
# Script to prepare and restore full and incremental backups created with innobackupex-runner.
#
# This script is provided as-is; no liability can be accepted for use.
#
INNOBACKUPEX=innobackupex-1.5.1
INNOBACKUPEXFULL=/usr/bin/$INNOBACKUPEX
TMPFILE="/tmp/innobackupex-restore.$$.tmp"
@lostsnow
lostsnow / sorting option select jQuery
Last active January 2, 2016 19:19 — forked from boy3vil/sorting option select jQuery
add chinese char support
<html>
<head>
<script type="text/javascript" src="../js/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('button').click(function() {
var options = $('select.whatever option');
var arr = options.map(function(_, o) {
#!/usr/bin/python
# Quick and dirty demonstration of CVE-2014-0160 by Jared Stafford (jspenguin@jspenguin.org)
# The author disclaims copyright to this source code.
import sys
import struct
import socket
import time
import select
@lostsnow
lostsnow / se.js
Created May 1, 2014 03:21 — forked from firedfox/se.js
//-----------------------------
// 从这里开始是web端同步来的数据
// 后端应该也需要从web端同步过来
//-----------------------------
// 站点配置
var c = {
// 搜索引擎配置
se: [
[1,'baidu.com','word|wd|w',1,'news,tieba,zhidao,mp3,image,video,hi,baike,wenku,opendata,jingyan'],
<?php
// https://github.com/fuchaoqun/colaphp/blob/2.0/Cola/Ext/GoogleAuthenticator.php
class Cola_Ext_GoogleAuthenticator
{
public static $ttl = 30;
public static $limit = 6;
// Lookup needed for Base32 encoding
private static $map = array(
@lostsnow
lostsnow / ocp.php
Last active August 29, 2015 14:06 — forked from ck-on/ocp.php
<?php
/*
OCP - Opcache Control Panel (aka Zend Optimizer+ Control Panel for PHP)
Author: _ck_ (with contributions by GK, stasilok)
Version: 0.1.6
Free for any kind of use or modification, I am not responsible for anything, please share your improvements
* revision history
0.1.6 2013-04-12 moved meta to footer so graphs can be higher and reduce clutter
0.1.5 2013-04-12 added graphs to visualize cache state, please report any browser/style bugs
@lostsnow
lostsnow / go.sh
Last active August 29, 2015 14:18 — forked from mindscratch/go.sh
docker run --rm -it centos:centos6 /bin/bash
yum install -y wget tar
wget https://github.com/GoogleCloudPlatform/kubernetes/releases/download/v0.5.4/kubernetes.tar.gz
wget https://github.com/coreos/etcd/releases/download/v0.4.6/etcd-v0.4.6-linux-amd64.tar.gz
# untar kubernetes and add binaries to path
tar -xf kubernetes.tar.gz
cd kubernetes/server
tar -xf kubernetes-server-linux-amd64.tar.gz
cd kubernetes/server/bin

Neutering the “developer mode” screen on your Chromebook

I am the proud owner of two Chromebooks – one Samsung Series 3 ARM Chromebook and one Samsung 550 Chromebook. Like many serial tinkerers the frowny/sick developer “warning” screen, which you get if you want to overwrite the operating system having to enable developer mode, is more of a pain than anything, much as I recognise it is for security. Having to press CTRL + D at every boot, or wait 30 seconds and endure a loud, audible beep is not my idea of slick fun. Happily, it is possible to all but disable this screen, by rewriting the BIOS with the correct “flags”. This leaves the screen enabled, but it only displays for 2 seconds, and there is no beep. Unhappily, you have to physically open the Chromebook up and disable the inbuilt BIOS write protect to take advantage of this.

The procedure is a follows:

  • Open Chromebook and enable/disable write protect jumpe
@lostsnow
lostsnow / genymotionwithplay.txt
Created March 11, 2016 01:32 — forked from wbroek/genymotionwithplay.txt
Genymotion with Google Play Services
Download the following ZIPs:
ARM Translation Installer v1.1 (http://www.mirrorcreator.com/files/0ZIO8PME/Genymotion-ARM-Translation_v1.1.zip_links)
Download the correct GApps for your Android version:
Google Apps for Android 6.0 (https://www.androidfilehost.com/?fid=24052804347835438 - benzo-gapps-M-20151011-signed-chroma-r3.zip)
Google Apps for Android 5.1 (https://www.androidfilehost.com/?fid=96042739161891406 - gapps-L-4-21-15.zip)
Google Apps for Android 5.0 (https://www.androidfilehost.com/?fid=95784891001614559 - gapps-lp-20141109-signed.zip)
Google Apps for Android 4.4.4 (https://www.androidfilehost.com/?fid=23501681358544845 - gapps-kk-20140606-signed.zip)
Google Apps for Android 4.3 (https://www.androidfilehost.com/?fid=23060877490000124 - gapps-jb-20130813-signed.zip)
@lostsnow
lostsnow / nginx.conf
Created December 21, 2016 09:35 — forked from Stanback/nginx.conf
Example Nginx configuration for adding cross-origin resource sharing (CORS) support to reverse proxied APIs
#
# CORS header support
#
# One way to use this is by placing it into a file called "cors_support"
# under your Nginx configuration directory and placing the following
# statement inside your **location** block(s):
#
# include cors_support;
#
# As of Nginx 1.7.5, add_header supports an "always" parameter which