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 subprocess | |
import time | |
import pywifi | |
from pywifi import const | |
import socket | |
import threading | |
""" | |
Global variable | |
""" |
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 subprocess | |
def get_wifi_info_mac(): | |
process = subprocess.Popen(['/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport','-I'], stdout=subprocess.PIPE) | |
out, err = process.communicate() | |
process.wait() | |
wifi_info = {} | |
for line in out.decode("utf-8").split("\n"): | |
if ": " in line: |
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 subprocess | |
def get_wifi_info_win(): | |
out = subprocess.check_output('netsh wlan show interfaces') | |
wifi_info = {} | |
for line in out.decode("utf-8", errors="ignore").split("\n"): | |
if ": " in line: | |
key, val = line.split(": ") | |
key = key.replace(" ", "") | |
val = val.strip() |
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
from tensorflow import keras | |
from tensorflow.keras import layers | |
class network(keras.Model): | |
def __init__(self): | |
super(network,self).__init__() | |
self.layer_1 = layers.Dense(8 , activation='relu') | |
self.layer_2 = layers.Dense(16 , activation='relu') | |
self.output_layer = layers.Dense(3 , activation='softmax') | |
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
from tensorflow.keras import layers | |
from tensorflow.keras.models import Model | |
def build_model(): | |
model_input = layers.Input(shape=(X.shape[-1],)) | |
x = layers.Dense(8,activation='relu')(model_input) | |
x = layers.Dense(16,activation='relu')(x) | |
model_output = layers.Dense(3,activation='softmax')(x) | |
return Model(model_input ,model_output) |
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
from tensorflow.keras.layers import Dense, Activation | |
from tensorflow.keras import Sequential | |
model = Sequential() | |
model.add(Dense(8, Activation('relu'), input_dim=X.shape[-1])) | |
model.add(Dense(16, Activation('relu'))) | |
model.add(Dense(3, Activation('softmax'))) |
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
public class Main { | |
static int arr[]= {1,2,3,4,5}; // S集合 | |
static int ans[]=new int[3]; // 從集合中取三個的組合 | |
public static void main(String[] args) { | |
backtracking(0,0); | |
} | |
public static void backtracking(int n,int pos) { | |
if(n==3) { // 若dimension維度是第三層代表找完答案依序印出並結束遞迴 | |
for(int i=0;i<3;i++) { | |
System.out.print(ans[i]+" "); |
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 java.util.*; | |
public class Main { | |
public static void main(String[] args) { | |
Scanner scn=new Scanner(System.in); | |
String str=scn.nextLine(); | |
String arr[]= {"hate","stupid","angry","dirty"},arr2[]= {"love","smart","happy","clean"}; | |
for(int i=0;i<4;i++) | |
str = str.replaceAll(arr[i], arr2[i]); |
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 java.util.*; | |
public class Main { | |
public static void main(String[] args) { | |
Scanner scn=new Scanner(System.in); | |
String str=scn.nextLine().replaceAll(" ", ""); | |
String arr[]=str.split(","); | |
int count =0; | |
for(int i=0;i<arr.length;i++) { |
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 java.util.*; | |
public class Main { | |
public static void main(String[] args) { | |
Scanner scn=new Scanner(System.in); | |
String str=""; | |
while(scn.hasNext()) { | |
str+=scn.nextLine()+" "; | |
} |
NewerOlder