Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@jaxbot
jaxbot / gist:54eaeac526c4e161e4c7
Last active August 29, 2015 14:18
PyCon WiFi auto-j'accepte

Here's how to automatically log in to the WiFi at PyCon. Dumping out a few different methods here, check back for updates!

Chrome

  1. Install Tampermonkey
  2. Add this script:
// ==UserScript==
// @name         Pycon auto j'accept
// @namespace http://your.homepage/
$("#thebutton").on("click", function(t) {
t.preventDefault(), t.stopPropagation();
if (e.hasClass("pressed"))
return;
r.thebutton._countdownInterval = window.clearInterval(r.thebutton._countdownInterval), r.thebutton._setTimer(6e4);
var n = {seconds: $("#thebutton-timer").val(),prev_seconds: r.thebutton._msgSecondsLeft,tick_time: r.thebutton._tickTime,tick_mac: r.thebutton._tickMac};
$.request("press_button", n, function(e) {
console.log(e)
}), e.addClass("pressed").removeClass("unlocked"), r.thebutton.pulse()
})
{
"currently": {
"apparentTemperature": 68.95,
"cloudCover": 0.18,
"dewPoint": 54.93,
"humidity": 0.61,
"icon": "clear-day",
"nearestStormBearing": 156,
"nearestStormDistance": 124,
"ozone": 338.39,
@jaxbot
jaxbot / form.html
Last active January 13, 2019 14:11
Node.js recaptcha example 2 (using AJAX instead of forms) https://jaxbot.me/articles/new-nocaptcha-recaptcha-with-node-js-express-12-9-2014
<!doctype html>
<html>
<head>
<script src='https://www.google.com/recaptcha/api.js'></script>
<script>
function registerAPI(form) {
var params = {
username: form.username.value,
password: form.password.value,
email: form.email.value,
<!doctype html>
<html>
<head>
<script src='https://www.google.com/recaptcha/api.js'></script>
</head>
<body>
<h1>Register for test site</h1>
<form action="register" method="post">
<input type="text" name="username" placeholder="Username"><br>
@jaxbot
jaxbot / Vim autocmds
Last active September 3, 2023 11:37
Vim MacBook LEDs
" Assuming keyboard_leds is built and available in your PATH,
" this will make capslock indicate whether or not you are in insert mode.
autocmd InsertEnter * :!keyboard_leds -c1
autocmd InsertLeave * :!keyboard_leds -c0
" To make Vim control the keyboard backlight, use this.
" Note that it's glitchy and you'll probably toss the idea soon after.
" I can see programmatically controlling the lights to be useful in other cases, though.
" Install Lab tick and set a hotkey for Toggle, and one for Brighten.
" http://labtick.proculo.de/
{
"authLastModifiedDate": "2014-08-16T19:11:54Z",
"authToken": "[redacted]",
"chargeRequestDate": null,
"chargeTime": "15 hrs 30 min ",
"chargeTime220": "5 hrs 30 min ",
"chrgDrtn22066Tx": "4 hrs 0 min ",
"class": "com.nissanusa.owners.VehicleCarwings",
"currentBattery": 4,
"currentCharging": "NOT_CHARGING",
#!/bin/bash
# Log in to Carwings web interface
curl --data "j_username=$LEAF_USERNAME&j_passwordHolder=Password&j_password=$LEAF_PASSWORD" -c cookiejar.tmp https://www.nissanusa.com/owners/j_spring_security_check
# Request a status update
curl -b cookiejar.tmp https://www.nissanusa.com/owners/vehicles/statusRefresh?id=$LEAF_CARID
# Download status JSON (sync, blocking)
curl -b cookiejar.tmp https://www.nissanusa.com/owners/vehicles/pollStatusRefresh?id=$LEAF_CARID
function *create() {
//this.body = yield render('submit', { referer: this.request.headers.referer, key: key || '' });
var results = yield db.query("INSERT INTO `posts` (bla, bla) VALUES (bla, bla)");
console.log(results);
this.response.end(); //redirect('/post/' + results[0][0].link);
}
#include <stdio.h>
#include <stdlib.h>
#define true 1
#define false 0
int main(void) {
int ptr = 4;
int feelings = (ptr + 1) ? true : false;