Skip to content

Instantly share code, notes, and snippets.

@cysin
cysin / kselection.py
Created February 2, 2016 12:31
A k-selection example in python
#!/usr/bin/python
import heapq
import random
import time
def createArray():
array = range( 10 * 1000 * 1000 )
random.shuffle( array )
return array
@cysin
cysin / m.diff
Created September 3, 2018 09:12
a patch to force stop app for android systems
project frameworks/base/
diff --git a/packages/SystemUI/AndroidManifest.xml b/packages/SystemUI/AndroidManifest.xml
index 070634b..3e359b4 100644
--- a/packages/SystemUI/AndroidManifest.xml
+++ b/packages/SystemUI/AndroidManifest.xml
@@ -90,6 +90,8 @@
<uses-permission android:name="android.permission.MANAGE_ACTIVITY_STACKS" />
<uses-permission android:name="android.permission.START_TASKS_FROM_RECENTS" />
<uses-permission android:name="android.permission.GET_INTENT_SENDER_INTENT" />
@cysin
cysin / mbn.py
Created November 20, 2018 00:24
mbn.py
import numpy as np
import sys,os
import argparse
caffe_root = '/root/work/caffe/'
sys.path.insert(0, caffe_root + 'python')
os.environ['GLOG_minloglevel'] = '3'
import caffe
#import google.protobuf as pb
import google.protobuf.text_format
import pprint as pp
#!/usr/bin/python
#-*- coding: utf-8 -*-
import numpy as np
import sys,os
reload(sys)
sys.setdefaultencoding("utf-8")
import argparse
caffe_root = '/root/work/caffe/'
sys.path.insert(0, caffe_root + 'python')
os.environ['GLOG_minloglevel'] = '3'
#!/usr/bin/python
#-*- coding: utf-8 -*-
import numpy as np
import sys,os
reload(sys)
sys.setdefaultencoding("utf-8")
import argparse
caffe_root = '/root/work/caffe/'
sys.path.insert(0, caffe_root + 'python')
os.environ['GLOG_minloglevel'] = '3'
@cysin
cysin / mount_qcow2.md
Created March 6, 2020 12:52 — forked from shamil/mount_qcow2.md
How to mount a qcow2 disk image

How to mount a qcow2 disk image

This is a quick guide to mounting a qcow2 disk images on your host server. This is useful to reset passwords, edit files, or recover something without the virtual machine running.

Step 1 - Enable NBD on the Host

modprobe nbd max_part=8