Skip to content

Instantly share code, notes, and snippets.

View mertsalik's full-sized avatar
🏡
WFH only.

Mert Salık mertsalik

🏡
WFH only.
View GitHub Profile
[loggers]
keys = root
[handlers]
keys = consoleHandler,fileHandler
[formatters]
keys = fileFormatter,consoleFormatter
[logger_root]
import numpy as np
def rgb2ycbcr(rgb_color):
"""
requires numpy
http://www.equasys.de/colorconversion.html
:param rgb_color: tuple(R,G,B)
:return: tuple(Y,Cb,Cr)
"""
if not isinstance(rgb_color, tuple):
raise TypeError("This method only accepts color parameter as tuple!")
from PIL import Image
import os
import argparse
if __name__ == "__main__":
parser = argparse.ArgumentParser(
description='Make biggest centered square of images in given directory')
parser.add_argument('--dir',
help='Project directory for search image files',
required=True)
import Foundation
class PrinterServiceBrowser: NSObject, NSNetServiceDelegate, NSNetServiceBrowserDelegate {
var services: NSMutableArray!
var serviceBrowser: NSNetServiceBrowser!
var service: NSNetService!
var onFinish: (NSMutableArray -> Void)
init(onFinishBrowsing: NSMutableArray -> Void) {

Taken from https://www.cyberciti.biz/open-source/learning-bash-scripting-for-beginners/

  1. BASH Programming – Introduction HOW-TO : This tutorials intends to help you to start programming basic-intermediate shell scripts. It does not intend to be an advanced document.

  2. Advanced Bash-Scripting Guide : An in-depth exploration of the art of shell scripting. A must read to master bash shell scripting for all Unix users.

  3. Learn Bash In Y Minutes : A quick tour of bash programming language.

  4. BASH Frequently Asked Questions : Greg’s Wiki includes answers to many bash programming problems in Q & A format.

rvictl -s <-udid->
// This adds a new virtual network interface xxxxxx.
ifconfig -l
// Get the list of interfaces again, and you can see the xxxxxx
sudo tcpdump -i xxxxxx -w ./output.pcap

// stop
rvictl -x <-udid->

From http://raspberrypi.stackexchange.com/a/312

If you are running Linux then you can use the dd command to make a full backup of the image:

dd if=/dev/diskx of=/path/to/image or for compression:

dd if=/dev/diskx | gzip > /path/to/image.gz Where sdx is your SD card. To restore the backup, you reverse the commands:

1 : 255,255,255 | 30,215,96
2 : 44,70,185 | 195,239,199
3 : 161,195,211 | 30,50,100
4 : 181,155,201 | 245,231,44
5 : 255,70,50 | 245,231,44
6 : 44,70,185 | 255,100,44
7 : 195,241,185 | 255,255,255
8 : 255,205,211 | 30,50,100
9 : 141,24,50 | 155,241,225
10 : 30,50,100 | 245,114,161
#!/bin/bash
#set -e
# install-wifi - 28/05/2017 - by MrEngman.
UPDATE_SELF=${UPDATE_SELF:-1}
UPDATE_URI="http://www.fars-robotics.net/install-wifi"
ROOT_PATH=${ROOT_PATH:-"/"}
WORK_PATH=${WORK_PATH:-"${ROOT_PATH}/root"}
# US East speedtest.newark.linode.com 100MB-newark.bin
# US South speedtest.atlanta.linode.com 100MB-atlanta.bin
# US Central speedtest.dallas.linode.com 100MB-dallas.bin
# US West speedtest.fremont.linode.com 100MB-fremont.bin
# Frankfurt speedtest.frankfurt.linode.com 100MB-frankfurt.bin
# London speedtest.london.linode.com 100MB-london.bin
# Singapore speedtest.singapore.linode.com 100MB-singapore.bin
# Tokyo 2, Japan speedtest.tokyo2.linode.com 100MB-tokyo2.bin
echo "US EAST"