Skip to content

Instantly share code, notes, and snippets.

@timnovinger
timnovinger / scrobble.py
Created August 31, 2011 18:13 — forked from jonpierce/scrobble.py
Last.fm scrobbling for Pianobar, the command-line Pandora client.
#!/usr/bin/env python
"""
Last.fm scrobbling for Pianobar, the command-line Pandora client. Requires Pianobar, Python, pyLast and Last.fm API credentials.
https://github.com/PromyLOPh/pianobar/
http://code.google.com/p/pylast/
http://www.last.fm/api/account
Installation:
1) Copy this script and pylast.py to the Pianobar config directory, ~/.config/pianobar/, and make sure this script is executable
@afair
afair / tmux.cheat
Last active June 3, 2024 23:26
Tmux Quick Reference & Cheat sheet - 2 column format for less scrolling!
========================================== ==========================================
TMUX COMMAND WINDOW (TAB)
========================================== ==========================================
List tmux ls List ^b w
New new -s <session> Create ^b c
Attach att -t <session> Rename ^b , <name>
Rename rename-session -t <old> <new> Last ^b l (lower-L)
Kill kill-session -t <session> Close ^b &
@gustavolsson
gustavolsson / isometricscrewthread.js
Last active March 17, 2021 18:45
This code generates an ISO metric screw thread given a set of parameters. The code is intended for Tinkercad Shape Scripts but it should be straightforward to port it to other platforms.
/*
Copyright (c) 2012 Gustav Olsson
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
@yourcelf
yourcelf / soma.py
Last active June 10, 2019 14:32
Command line script to play somafm radio stations. Type `soma.py --help` for usage, but briefly: `soma.py <stationname>` plays the station, `soma.py` with no argument lists the available stations. Uses mplayer to do the playing (change with --player option).
#!/usr/bin/env python
from __future__ import print_function
import sys
import subprocess
import argparse
import textwrap
import signal
stations = {
@fireismyflag
fireismyflag / torrent-info.py
Last active July 12, 2020 10:29
This Python script will connect to a Deluge deamon running on localhost, and generate a summarized status of active torrents.
import os
'''
The command "deluge-console info" generates this output:
/home/pi$ deluge-console info
Name: Some video file
ID: 670b10e3842dfe57bedbd0653b09f0548034cbbb
@thomasfr
thomasfr / iptables.sh
Last active April 13, 2024 01:59
iptable rules to allow outgoing DNS lookups, outgoing icmp (ping) requests, outgoing connections to configured package servers, outgoing connections to all ips on port 22, all incoming connections to port 22, 80 and 443 and everything on localhost
#!/bin/bash
IPT="/sbin/iptables"
# Server IP
SERVER_IP="$(ip addr show eth0 | grep 'inet ' | cut -f2 | awk '{ print $2}')"
# Your DNS servers you use: cat /etc/resolv.conf
DNS_SERVER="8.8.4.4 8.8.8.8"
# Allow connections to this package servers
@adrelanos
adrelanos / deactivate_vpn_firewall
Created April 13, 2014 02:07
deactivate vpn firewall
#!/bin/bash
set -x
iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X
iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
## Install RSSOwl 2.2.1 on Fedora 21
[root@goll ~]# java -version
openjdk version "1.8.0_40"
OpenJDK Runtime Environment (build 1.8.0_40-b25)
OpenJDK 64-Bit Server VM (build 25.40-b25, mixed mode)
@ikegami-yukino
ikegami-yukino / google_login.py
Created June 12, 2015 09:26
Automatically Google login by selenium
mail_address = ''
password = ''
from selenium import webdriver
UA = 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0'
PHANTOMJS_ARG = {'phantomjs.page.settings.userAgent': UA}
driver = webdriver.PhantomJS(desired_capabilities=PHANTOMJS_ARG)
url = 'https://www.google.com/accounts/Login?hl=ja&continue=http://www.google.co.jp/'
@0
0 / bluetooth_serial.md
Last active May 15, 2024 07:01
Connecting a Bluetooth device for serial communication on Arch Linux.

The following are instructions for connecting a Bluetooth device for serial communication on Arch Linux using BlueZ 5.31.

Prerequisites

The following packages are required:

  • bluez: bluetoothd
  • bluez-utils: bluetoothctl, rfcomm