Skip to content

Instantly share code, notes, and snippets.

View scorpiodawg's full-sized avatar
🤪
Compiling... (TPS reports)

Ravi Subramanian scorpiodawg

🤪
Compiling... (TPS reports)
View GitHub Profile
@ValCanBuild
ValCanBuild / GetCpuTempAndroid.java
Created January 9, 2017 21:04
A way to get the CPU temperature from an android device by using the sys/class/thermal/temp command
public float getCpuTemp() {
Process p;
try {
p = Runtime.getRuntime().exec("cat sys/class/thermal/thermal_zone0/temp");
p.waitFor();
BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line = reader.readLine();
float temp = Float.parseFloat(line) / 1000.0f;
@fbrnc
fbrnc / counter.js
Created June 9, 2016 04:27
Simple hit counter with node.js and Redis
var db = require("redis-client").createClient();
require("http").createServer(function(request, response) {
db.incr("count",function(err, reply) {
response.writeHead(200, { "Content-Type": "text/plain" });
response.write(reply.toString());
response.end();
});
}).listen(8181);
@yoavniran
yoavniran / ultimate-ut-cheat-sheet.md
Last active April 13, 2024 16:19
The Ultimate Unit Testing Cheat-sheet For Mocha, Chai, Sinon, and Jest
@simlegate
simlegate / custom-error-page
Created October 31, 2014 05:35
Nginx return custom json
error_page 400 404 405 =200 @40*_json;
location @40*_json {
default_type application/json;
return 200 '{"code":"1", "message": "Not Found"}';
}
error_page 500 502 503 504 =200 @50*_json;
location @50*_json {
@rishabhmhjn
rishabhmhjn / android_pkg_name_validate.js
Last active March 2, 2022 02:04
Regex to validate Android Package Name
var pattern = /^[a-z][a-z0-9_]*(\.[a-z0-9_]+)+[0-9a-z_]$/i;
[
"me.unfollowers.droid",
"me_.unfollowers.droid",
"me._unfollowers.droid",
"me.unfo11llowers.droid",
"me11.unfollowers.droid",
"m11e.unfollowers.droid",
"1me.unfollowers.droid",
@tony4d
tony4d / p4merge4git.md
Created August 24, 2012 19:00
Setup p4merge as a visual diff and merge tool for git
@spraints
spraints / gist:1648617
Created January 20, 2012 17:40
setting up a subscription with stripe

Subscriptions with stripe

Code examples use the stripe ruby gem. Most of the links are to stripe's documentation.

![stripe's object model][stripe_object_model_diagram]

Initial setup

To start, create some plans.