- sudo -i
- cd /var
- dd if=/dev/zero of=swap.file bs=1M count=2048
- mkswap swap.file
- chmod 600 swap.file
- swapon swap.file
- // copy UUID
- vi /etc/fstab ==>
UUID=f1ed55b6-357b-4427-86c8-d57f034cf29e none swap defaults 0 0
- mount -a
- echo $? // should be 0 if everything is OK
This file contains 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
lsblk | |
umount /dev/sdc | |
sudo fdisk /dev/sdc | |
d,d,d,d,... | |
n | |
w | |
sudo mkfs.vfat /dev/sdc1 | |
sudo dd if=/path/to/ubuntu.iso of=/dev/sdb bs=1M |
This file contains 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
openssl pkcs7 -in mycert.p7b -inform DER -print_certs -out mycert.pem | |
sudo cp mycert.pem /etc/pki/ca-trust/source/anchors/ | |
sudo update-ca-trust |
This file contains 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/bash | |
set -ex | |
cd `dirname $0` | |
cd .. | |
ROOT_DIR=$(pwd) | |
APP=utest | |
LOWERAPP=${APP,,} |
This file contains 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/bash -eux | |
# This is a very simple example on how to bundle a Python application as an AppImage | |
# using virtualenv and AppImageKit using Ubuntu | |
# NOTE: Please test the resulting AppImage on your target systems and copy in any additional | |
# libraries and/or dependencies that might be missing on your target system(s). | |
######################################################################## | |
# Get virtualenv on the target system | |
######################################################################## |
I know I'm late with this article for about 5 years or so, but people are still using Python 2.x, so this subject is relevant I think.
Some facts first:
- Unicode is an international encoding standard for use with different languages and scripts
- In python-2.x, there are two types that deal with text.
str
is an 8-bit string.
unicode
is for strings of unicode code points.
This file contains 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/bash | |
target="$1" | |
remotePath="$2" | |
device="${3:-/dev/ttyUSB0}" | |
# compress target files using tar | encode data to base64 string | remove \n | |
compress="tar -C `dirname $target` -cjvf - `basename $target` | base64 | tr -d '\n'" | |
# decode base64 string using python (using python because my device doesn't have base64) | |
base64decode="import base64, sys; sys.stdout.write(base64.b64decode(sys.stdin.read()))" |
This file contains 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
# tmux v2.0 installation steps for Ubuntu 14.04 (Trusty Tahr) | |
# tmux -V | |
# sudo apt-get update | |
# sudo apt-get install -y python-software-properties software-properties-common | |
# sudo add-apt-repository -y ppa:pi-rho/dev | |
# sudo apt-get update | |
# sudo apt-get install -y tmux | |
# tmux -V | |
# use UTF8 |
This file contains 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
import pytest | |
class DictHasValus(dict): | |
""" | |
DictHasValus({('foo', 'bar'): 'hello'}) == {'foo': {'bar': 'hello'}} | |
""" | |
def __eq__(self, other): | |
try: |