This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
以下是MainActivity.java的内容 | |
建议在第34行之后加一句 this.finish(); | |
*/ | |
public class MainActivity extends Activity { | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//#define USE_QSORT | |
// 上面一行取消注释就调用 C 自带的快速排序算法,否则使用手写的冒泡排序 | |
#include <stdio.h> | |
#include <stdlib.h> | |
int iabs(int a) | |
{ | |
return a > 0 ? a : -a; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <IRremotea.h> | |
#include <Wire.h> | |
#include <avr/pgmspace.h> //to use PROGMEM | |
//#define USE_LED | |
#define LEDMAX 255 | |
#define LEDMIN 0 | |
#define LEDSTEP 3 | |
#define LEDSTEP2 20 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Copyright (c) 2015, James Swineson <jamesswineson@gmail.com> | |
# | |
# Permission to use, copy, modify, and/or distribute this software for any | |
# purpose with or without fee is hereby granted, provided that the above | |
# copyright notice and this permission notice appear in all copies. | |
# | |
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | |
# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dnsDomainIs = function (h, d) { | |
return h.indexOf(d, h.length - d.length) !== -1 && (d.length === h.length || h.indexOf("." + d, h.length - ("." + d).length) !== -1) | |
} | |
function FindProxyForURL(u, h) { | |
h = h.toLowerCase(); | |
if (h === "appdownload.itunes.apple.com" || dnsDomainIs(h, "battlenet.com.cn") || dnsDomainIs(h, "dist.blizzard.com.edgesuite.net") || /us-ore-\d+\.s3\.amazonaws\.com/.test(h) || /\w{2}-\w{3}-\d{5}\.s3\.amazonaws\.com/.test(h)) { | |
return "DIRECT" | |
} | |
a = []; // user ignore list |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://www.digitalocean.com/community/questions/mysql-server-keeps-stopping-unexpectedly | |
# http://pastie.org/8665237 | |
# Generated by Percona Configuration Wizard (http://tools.percona.com/) version REL5-20120208 | |
[mysql] | |
# CLIENT # | |
port = 3306 | |
socket = /var/run/mysqld/mysqld.sock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Love-o-meter rewritten code | |
// by James Swineson, 2015-10-13 | |
// For demonstration use only. | |
// =========== Settings =========== | |
// Total LED number | |
#define LEDCOUNT 5 | |
// Which digital pins are LEDs connected to. They will light up from left to right. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "Updating hosts..." | |
wget --show-progress -O hosts -- https://github.com/StevenBlack/hosts/raw/master/hosts && /etc/init.d/dnsmasq restart | |
echo "Update finished. " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
String padding | |
by James Swineson (@Jamesits) | |
https://gist.github.com/Jamesits/30acd725d5fdfb67eae4 | |
Make a string fixed length by adding blank chars between or after it. | |
Usage: | |
"123".lpadding(5) // returns " 123" | |
"123".lpadding(5, "0") // returns "00123" | |
"123".lpadding(2) // returns "23" | |
"123".rpadding(5) // returns "123 " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# James' Gene T-tester | |
# Written by James Swineson <jamesswineson@gmail.com>, 2016-01-27 | |
# All rights reserved. | |
# | |
# Install dependencies: | |
# pip3 install numpy scipy | |
# | |
# Tested to work under Python 3.5.1 on OS X 10.11.3 |
OlderNewer