Skip to content

Instantly share code, notes, and snippets.

View uberswe's full-sized avatar

Uberswe uberswe

  • Västerås, Sweden
  • 01:43 (UTC +01:00)
View GitHub Profile
__author__ = 'MarkusTenghamn'
# cocoa_keypress_monitor.py by Bjarte Johansen is licensed under a
# License: http://ljos.mit-license.org/
# add the terminal application you run python from to application that are allowed to control your computer. This can be done in System Preferences > Privacy > Accessability.
from AppKit import NSApplication, NSApp
from Foundation import NSObject, NSLog
from Cocoa import NSEvent, NSKeyDownMask
from PyObjCTools import AppHelper
@uberswe
uberswe / json.php
Created December 19, 2015 00:21
PFSense simple json API
<?php
/**
* Created by PhpStorm.
* User: Markus Tenghamn
* Date: 18/12/15
* Time: 11:56
*
* Place this in /usr/local/www/ and access it to get basic data about your pfsense installation. Use at your own risk.
*
*/
[
{
"code": "011",
"region": "Norrk\u00f6ping",
"state": "\u00d6sterg\u00f6tlands l\u00e4n"
},
{
"code": "0120",
"region": "\u00c5tvidaberg",
"state": "\u00d6sterg\u00f6tlands l\u00e4n"
@uberswe
uberswe / slack.php
Created September 14, 2016 19:15
Post updates to Slack with PHP
$message = "Hello this is a test!"; // The message you would like to send
$parameters = array(
'channel' => 'testing', // Simply type your channel name, make sure your bot is invited
'text' => html_entity_decode($message), // Good idea to decode
'as_user' => 'true');
// Use groups.list if you run into channel_not_found issues with private channels, make sure your bot is invited
$url = "https://slack.com/api/"."chat.postMessage"; // chat.postMessage is the method
$parameters['token'] = "MY-API-TOKEN"; // replace MY-API-TOKEN with the API Token for your bot
@uberswe
uberswe / automile-trip-test.php
Created October 3, 2016 15:18
Automile trip test
/**
* Created by Markus Tenghamn
*/
ini_set('display_errors', 1);
error_reporting(E_ALL);
$client_id = "";
$client_secret = "";
$scopes = array('read', 'write');
foreach ($tournament->groups as $group) {
$i = 0;
foreach ($group->games->all() as $game) {
$x = 0;
foreach ($game->teams as $team) {
foreach ($teams as $t) {
if ($t == $team->name) {
break;
}
}
package main
// Scratch File for https://github.com/markustenghamn/bittrex-trading-bot
import "log"
func main() {
var1 := 0.000273
var2 := 0.0002733
var3 := 0.0002734
@uberswe
uberswe / slack.php
Last active December 29, 2018 12:02
Post a simple slack message using a bot. See my blog post at https://gophp.io/developing-slack-bots-with-php-part-1 for a guide on how this works.
<?php
/**
* Created by Markus Tenghamn @ GoPHP.io
* Date: 2018-12-29
* Time: 12:47
*
* Post a simple slack message using a bot. You can run this in a console with 'php slack.php'
*
* See my blog post at https://gophp.io/developing-slack-bots-with-php-part-1 for a guide on how this works
*/
@uberswe
uberswe / main.go
Created January 4, 2019 21:23
Post a simple Slack message with Go using a bot
package main
// Created by Markus Tenghamn @ GoPHP.io
//
// Post a simple Slack message using a bot
import (
"bytes"
"encoding/json"
"fmt"
@uberswe
uberswe / franzbrotchen
Created January 12, 2019 17:09
A simple franzbrotchen recipe to make 4-5 portions
2 x 7g yeast
125ml warm milk
250g plain flour
35g powdered sugar
35g soft butter
pinch salt
100g soft butter
100g powdered sugar
2 teaspoons cinnamon