View string_split.cpp
std::vector<std::string> split_line(std::string str, std::string sub) | |
{ | |
std::vector<std::string> vector_split_line; | |
std::string split_line = ""; | |
std::string sub_line = ""; | |
bool skip = false; | |
for ( int current_char = 0; current_char < str.length(); current_char++ ) | |
{ | |
if ( str[current_char] == sub[0] ) | |
{ |
View flash-all.py
#!/bin/python | |
from multiprocessing import Process | |
import sys | |
import subprocess | |
import time | |
def device_ids(): | |
device_ids = [] | |
devices = subprocess.check_output(["adb", "devices"]).split() |
View mail.py
import smtplib | |
import sys | |
class gmail(object): | |
"""docstring for gmail""" | |
def __init__( self, username, password ): | |
self.username = username | |
self.password = password | |
self.login() |
View resize.py
#! /usr/bin/python | |
from PIL import Image | |
import sys | |
import os | |
imageFile = sys.argv[1] | |
file_name = imageFile.split(".")[0] | |
ext = imageFile.split(".")[-1] | |
sizes = [] |
View mysql.py
import MySQLdb | |
db_config = { | |
"host":"localhost", | |
"username":"username", | |
"password":"password", | |
"name":"name_of_database" | |
} | |
def query( query, bindings = False ): |
View AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?> | |
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | |
package="com.intel.camerawebserver" > | |
<uses-permission android:name="android.permission.INTERNET" | |
android:required="true" /> | |
<uses-feature android:name="android.hardware.camera" | |
android:required="true" /> | |
<application |
View image_video.js
var image_video = function image_video ( id ) | |
{ | |
this.image_element = document.getElementById( id ); | |
this.page = this.image_element.src; | |
this.running = false; | |
return this; | |
} | |
image_video.prototype.get_image = function get_image ( page, callback ) | |
{ |
View startvms.sh
#!/bin/bash | |
# Run as root | |
touch /etc/init.d/startvms | |
chmod +x /etc/init.d/startvms | |
update-rc.d startvms defaults 99 01 | |
cat <<'EOF' >> /etc/init.d/startvms | |
#! /bin/sh | |
# /etc/init.d/startvms | |
# |
View swap_bits.c
char swap_bits( char byte, int one, int two ) | |
{ | |
char tmp_1, tmp_2, swap; | |
int hex_1 = pow(2, one); | |
int hex_2 = pow(2, two); | |
tmp_1 = byte & hex_1; | |
tmp_1 = tmp_1 >> abs( one - two ); | |
tmp_2 = byte & hex_2; | |
tmp_2 = tmp_2 << abs( one - two ); | |
if ( tmp_1 == 0 && tmp_2 != 0 ) |
View apache_proxy.conf
<VirtualHost *:80> | |
ServerName something.example.com | |
ProxyRequests Off | |
<Proxy *> | |
Order deny,allow | |
Allow from all | |
</Proxy> | |
ProxyPass / http://server:port/ |
OlderNewer