Skip to content

Instantly share code, notes, and snippets.

View Fysac's full-sized avatar
🙅‍♂️

Fysac

🙅‍♂️
View GitHub Profile
@Fysac
Fysac / NetworkManager.conf
Created July 9, 2017 22:40
Fix for NetworkManager WiFi issue with certain adapters in latest Debian/Ubuntu
[main]
plugins=ifupdown,keyfile
[ifupdown]
managed=false
# Fixes a WiFi issue in Debian 9 and Ubuntu >=17.04.
# If you're able to see a list of access points in NetworkManager, but unable to connect to any of them, you should try this.
# Source: https://bugs.launchpad.net/ubuntu/+source/network-manager/+bug/1681513/comments/1
[device]
@Fysac
Fysac / imgur
Last active August 29, 2015 14:23 — forked from vivien/imgur
#!/bin/sh
#
# Upload image(s) to imgur.com
# Copyright (C) 2014 Vivien Didelot <vivien@didelot.org>
# Licensed under GPL version 3, see http://www.gnu.org/licenses/gpl.txt
#
# Requires "jshon":
# http://kmkeen.com/jshon/
#
# Alternatives, which suck:
@Fysac
Fysac / discussion_fix.js
Last active August 29, 2015 14:19
Wikispaces Discussion Workaround
<script type="text/javascript">
// Add this as an "Other HTML" widget to your wiki's navigation menu.
window.onload = setTimeout(function(){
while (wikispaces_page.indexOf(" ") != -1){
wikispaces_page = wikispaces_page.replace(" ", "+");
}
var anchors = document.getElementsByTagName("a");
for (var i = 0; i < anchors.length; i++) {
@Fysac
Fysac / Interrupt.ino
Created February 8, 2015 05:37
Pulse Rate
volatile int rate[10]; // array to hold last ten IBI values
volatile unsigned long sampleCounter = 0; // used to determine pulse timing
volatile unsigned long lastBeatTime = 0; // used to find IBI
volatile int P =512; // used to find peak in pulse wave, seeded
volatile int T = 512; // used to find trough in pulse wave, seeded
volatile int thresh = 525; // used to find instant moment of heart beat, seeded
volatile int amp = 100; // used to hold amplitude of pulse waveform, seeded
// ==UserScript==
// @name Instaload
// @namespace https://fysac.me
// @description Autoloads the next page of photos on Instagram as you scroll down.
// @include http://instagram.com/*
/* Fixed - I am an idiot!
The JSON selector "serverID" (line 12) should be "serverId".
Then remove "shouldRead" from the whole equation.
Bugged code preserved below for posterity.
*/
@SuppressWarnings("unchecked")
public void sendSessionRequest(String serverIdHash) throws IOException {
JSONObject payload = new JSONObject();
payload.put("accessToken", accessToken);
@Fysac
Fysac / counter.php
Last active January 20, 2023 17:28
Database-less, sessionless way to count online users in PHP.
<?php
$timeout = 300; // 5 minutes
$time = time();
$ip = $_SERVER["REMOTE_ADDR"];
$file = "users.txt";
$arr = file($file);
$users = 0;
for ($i = 0; $i < count($arr); $i++){
if ($time - intval(substr($arr[$i], strpos($arr[$i], " ") + 4)) > $timeout){