Skip to content

Instantly share code, notes, and snippets.

@bpsib
bpsib / BBC-Radio-HLS.m3u
Last active May 1, 2024 11:32 — forked from stengland/BBC-Radio.m3u
BBC Radio Streams
#EXTM3U
#EXTINF:-1,BBC - Radio 1
http://as-hls-ww-live.akamaized.net/pool_904/live/ww/bbc_radio_one/bbc_radio_one.isml/bbc_radio_one-audio%3d96000.norewind.m3u8
#EXTINF:-1,BBC - Radio 1Xtra
http://as-hls-ww-live.akamaized.net/pool_904/live/ww/bbc_1xtra/bbc_1xtra.isml/bbc_1xtra-audio%3d96000.norewind.m3u8
#EXTINF:-1,BBC - Radio 1Dance
http://as-hls-ww-live.akamaized.net/pool_904/live/ww/bbc_radio_one_dance/bbc_radio_one_dance.isml/bbc_radio_one_dance-audio%3d96000.norewind.m3u8
#EXTINF:-1,BBC - Radio 1Relax
http://as-hls-ww-live.akamaized.net/pool_904/live/ww/bbc_radio_one_relax/bbc_radio_one_relax.isml/bbc_radio_one_relax-audio%3d96000.norewind.m3u8
#EXTINF:-1,BBC - Radio 2
@iben12
iben12 / 1_Laravel_state-machine.md
Last active August 12, 2023 08:36
Laravel: State-machine on Eloquent Model

Implementing State Machine On Eloquent Model*

* Update (12.09.2017): I have improved the trait so that it can be used with objects other than Eloquent Models.

Some days ago I came across a task where I needed to implement managable state for an Eloquent model. This is a common task, actually there is a mathematical model called "Finite-state Machine". The concept is that the state machine (SM) "can be in exactly one of the finite number of states at any given time". Also changing from one state to another (called transition) depends on fulfilling the conditions defined by its configuration.

Practically this means you define each state that the SM can be in and the possible transitions. To define a transition you set the states on which the transition can be applied (initial conditions) and the only state in which the SM should be after the transition.

That's the theory, let's get to the work.

@artheus
artheus / py3lock.py
Created September 28, 2016 10:36
Small change to Gist made by https://gist.github.com/Airblader
#!/usr/bin/python
import os
import xcb
from xcb.xproto import *
from PIL import Image, ImageFilter
XCB_MAP_STATE_VIEWABLE = 2
def screenshot():
-- enabling the next line will delete your current entries so that the creates new ones. I would enable it, but make a backup of your files on first run to be sure.
-- do shell script "rm -rf /Users/Path/to/Files/*.taskpaper"
tell application "Reminders"
set output to ""
repeat with i from 1 to (count of (reminders whose completed is false))
set theReminder to reminder i of (reminders whose completed is false)
set reminderName to name of theReminder
set theList to name of container of theReminder
set dueDate to due date of theReminder
@prenagha
prenagha / VPN Toggle.scpt
Created November 5, 2012 15:16
VPN toggle applescript for launchbar
--
-- applescript to toggle connection state of vpn
-- http://markupboy.com/blog/view/toggling-vpn-with-applescript
-- http://www.plankdesign.com/blog/2012/06/toggle-your-network-settings-with-launchbar/
--
tell application "System Events"
tell current location of network preferences
-- set this to the name of your VPN config
set VPNservice to service "vpn service name"
set isConnected to connected of current configuration of VPNservice
@pitch-gist
pitch-gist / gist:2999707
Created June 26, 2012 22:21
HTML: Simple Maintenance Page
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>