This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# To be placed in /etc/systemd/system/fahclient.service | |
# Remove /etc/init.d/FAHClient. | |
# Use `systemctl enable/disable fahclient` to enable/disable auto start. | |
[Unit] | |
Description=Folding@home Client | |
After=network.target | |
Requires=network.target | |
[Service] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/ash | |
# Switch network configs according to the position of the 3way-switch, with help of the slide-switch package. | |
# Setup: | |
# * install `slide-switch` package (opkg install slide-switch) | |
# * Setup network interface `lan` as bridge interface with bridge device 'br-lan' | |
# * Setup network interface `wan` without physical interface | |
# * Place this file in /etc/hotplug.d/button/70-network-switch.sh | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
# Copyright (c) 2012-2016 Dan Wheeler and Dropbox, Inc. | |
# | |
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x = [1,2,3] | |
y = ['α', 'β', 'γ'] | |
# List comprehension works | |
g = [["{}_{}".format(a,b) for b in y] for a in x] | |
print(g) | |
# output: [['1_α', '1_β', '1_γ'], ['2_α', '2_β', '2_γ'], ['3_α', '3_β', '3_γ']] | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import shutil | |
import os | |
import argparse | |
import urllib.parse | |
import math | |
# Parse command line arguments | |
parser = argparse.ArgumentParser(description='Copy all music files listed in an m3u file to a destination directory.') | |
parser.add_argument('playlist', type=str, help='The m3u playlist file') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# based on http://stackoverflow.com/a/3628777 | |
def fast_max(a,b,c,d): | |
if (a > b): | |
firstmax = a | |
firstmin = b | |
else: | |
firstmax = b | |
firstmin = a | |
if (c > d): |