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
WSADATA wsaData; | |
int iResult; | |
iResult = WSAStartup(MAKEWORD(2,2),&wsaData); | |
if (iResult != 0) { | |
return; | |
} | |
SOCKADDR_IN server; | |
server.sin_family = AF_INET; | |
server.sin_addr.s_addr = INADDR_ANY; |
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
LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) | |
{ | |
switch(msg) { | |
case WM_CLOSE: | |
DestroyWindow(hWnd); | |
break; | |
case WM_DESTROY: | |
PostQuitMessage(0); | |
break; | |
default: |
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 | |
IFS=$'\r\n' | |
array=(`lsusb -v 2> /dev/null | grep "\(Bus\|bInterfaceClass\)" | awk -F ' ' '{if(/Bus/){printf "%s ",$0} else {$1="";$2="-";print $0}}' | grep -o "ID.*"`) | |
for i in `seq 0 $(expr ${#array[*]} - 1)`; do | |
echo -n "$i " | |
echo "${array[$i]}" | |
done | |
echo -n "choose usb device: " | |
id=`echo ${array[$(read)]} | grep -o "[0-9]\+:[0-9]\+"` | |
virsh list --all |
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
#!/usr/bin/python | |
# -*- coding:utf-8 -*- | |
import sys | |
def parse(s): | |
return list(map(lambda c : 0 if c == ' ' else ord(c) - ord('0'), s)) | |
board = [parse(input()) for i in range(9)] | |
# s = input() | |
# board = [parse(s[i * 9 : i * 9 + 9]) for i in range(9)] | |
# input() | |
# answer = [parse(input()) for i in range(9)] |
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
#!/usr/bin/python | |
import sys | |
import code | |
from lxml import etree | |
from lxml.builder import E | |
from ncclient import manager | |
_, ip, user, passwd = sys.argv | |
netconf = manager.connect(host=ip, port=830, username=user, password=passwd, |
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
#!/usr/bin/python | |
import sys | |
import code | |
from lxml import etree | |
from lxml.builder import E | |
from ncclient import manager | |
_, ip, user, passwd = sys.argv | |
netconf = manager.connect(host=ip, port=830, username=user, password=passwd, |
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
#!/usr/bin/python | |
import sys | |
_, ip, user, passwd = sys.argv | |
CLI_PROMPT = r'[\[<][^>\]]+[\]>]' | |
ssh = spawn('ssh %s@%s' % (username, ip)) | |
if not ssh: | |
return | |
ssh.expect('password') |
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
#!/usr/bin/python | |
import ipaddress | |
import argparse | |
from mininet.topo import Topo | |
from mininet.nodelib import LinuxBridge | |
from mininet.net import Mininet | |
from mininet.cli import CLI | |
from mininet.util import waitListening |
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
Name: emacs25 | |
Version: 25.3 | |
Release: 1%{?dist} | |
Summary: GNU Emacs | |
#Group: | |
License: GPL | |
URL: http://www.gnu.org/software/emacs/ | |
Source0: http://mirrors.ustc.edu.cn/gnu/emacs/emacs-%{version}.tar.gz | |
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) |
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 | |
entries=($(find /dev/disk/by-id -type l -printf '%l %f\n' | grep -v '\(part\|wwn\)' | sed 's#../../##g' | tr '\n' ' ')) | |
entries+=('' '' 'rescan' 'RESCAN') | |
choice=$(whiptail --notags --title "Hotplug" --menu "Select device" 16 100 9 "${entries[@]}" 3>&1 1>&2 2>&3) | |
test -n "$choice" || exit 0 | |
case $choice in | |
"rescan") | |
echo 'Rescan disks...' | |
echo '- - -' > /sys/class/scsi_host/host0/scan |
OlderNewer