text
stringlengths
1
1.05M
-- phpMyAdmin SQL Dump -- version 3.2.0.1 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: Feb 09, 2017 at 07:18 -- Server version: 5.1.37 -- PHP Version: 5.3.0 SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; -- -- Database: `dbeljaticket` -- -- -------------------------------------------------------- -- -- Table structure for table `admin` -- CREATE TABLE IF NOT EXISTS `admin` ( `username` varchar(5) NOT NULL, `password` varchar(5) NOT NULL, PRIMARY KEY (`username`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `admin` -- INSERT INTO `admin` (`username`, `password`) VALUES ('admin', '<PASSWORD>'); -- -------------------------------------------------------- -- -- Table structure for table `bayar` -- CREATE TABLE IF NOT EXISTS `bayar` ( `kode_bayar` varchar(20) NOT NULL, `tgl_bayar` date NOT NULL, `jml_bayar` int(6) NOT NULL, `kode_pesan` int(16) NOT NULL, `jadwal` varchar(50) NOT NULL, PRIMARY KEY (`kode_bayar`), KEY `kode_pesan` (`kode_pesan`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -- Dumping data for table `bayar` -- INSERT INTO `bayar` (`kode_bayar`, `tgl_bayar`, `jml_bayar`, `kode_pesan`, `jadwal`) VALUES ('03012017105023', '2017-01-03', 50000, 141220286, 'PSS Sleman vs Persija Jakarta'), ('29122016012329', '2016-12-29', 60000, 141220280, 'PSS Sleman vs Persija Jakarta'), ('03012017024509', '2017-01-03', 40000, 141220292, ' PSS Sleman vs Persija Jakarta '), ('29122016122208', '2016-12-29', 40000, 141220276, 'PSS Sleman vs Persija Jakarta'), ('29122016010702', '2016-12-29', 50000, 141220277, 'PSS Sleman vs Persija Jakarta'), ('29122016010822', '2016-12-29', 150000, 141220278, 'PSS Sleman vs Persija Jakarta'), ('29122016011010', '2016-12-29', 40000, 141220279, 'PSS Sleman vs Persija Jakarta'), ('03012017123938', '2017-01-03', 150000, 141220275, 'PSS Sleman vs Persija Jakarta'), ('03012017124010', '2017-01-03', 30000, 141220274, 'PSS Sleman vs Persija Jakarta'), ('03012017124110', '2017-01-03', 100000, 141220273, 'PSS Sleman vs Persija Jakarta'), ('03012017124148', '2017-01-03', 100000, 141220265, 'PSS Sleman vs Persija Jakarta'), ('03012017124238', '2017-01-03', 30000, 141220261, 'PSS Sleman vs Persija Jakarta'), ('03012017124253', '2017-01-03', 40000, 141220251, 'PSS Sleman vs Persija Jakarta'), ('03012017124400', '2017-01-03', 30000, 141220249, 'PSS Sleman vs Persija Jakarta'), ('03012017124531', '2017-01-03', 60000, 141220245, 'PSS Sleman vs Persija Jakarta'), ('03012017021921', '2017-01-03', 20000, 141220290, 'PSS Sleman vs Persija Jakarta'), ('03012017023907', '2017-01-03', 50000, 141220291, ' PSS Sleman vs Persebaya Surabaya '), ('04012017120645', '2017-01-04', 40000, 141220295, 'PSS Sleman vs Persebaya Surabaya'), ('04012017045312', '2017-01-04', 50000, 141220297, 'PSS Sleman vs Persebaya Surabaya'), ('04012017054011', '2017-01-04', 50000, 141220298, 'PSS Sleman vs Persebaya Surabaya'), ('04012017062245', '2017-01-04', 20000, 141220299, 'PSS Sleman vs Persebaya Surabaya'), ('04012017065554', '2017-01-04', 30000, 141220300, 'PSS Sleman vs Persebaya Surabaya'), ('04012017083836', '2017-01-04', 50000, 141220302, 'PSS Sleman vs Persebaya Surabaya'), ('05012017104045', '2017-01-05', 50000, 141220303, 'PSS Sleman vs Persija Jakarta'), ('05012017021138', '2017-01-05', 40000, 141220336, 'PSS Sleman vs Persija Jakarta'), ('05012017023443', '2017-01-05', 90000, 141220337, 'PSS Sleman vs Persija Jakarta'), ('16012017084438', '2017-01-16', 150000, 141220341, 'PSS Sleman vs Persita Tangerang'), ('10012017065615', '2017-01-10', 20000, 141220340, 'PSS Sleman vs Persita Tangerang'), ('16012017092818', '2017-01-16', 40000, 141220342, 'PSS Sleman vs Persita Tangerang'), ('24012017083652', '2017-01-24', 50000, 141220343, 'PSS Sleman vs Persita Tangerang'), ('24012017103335', '2017-01-24', 50000, 141220345, 'PSS Sleman vs Persita Tangerang'), ('24012017104019', '2017-01-24', 50000, 141220346, 'PSS Sleman vs Persita Tangerang'), ('30012017125014', '2017-01-30', 20000, 141220347, 'PSS Sleman vs Persita Tangerang'), ('30012017080135', '2017-01-30', 60000, 141220348, 'PSS Sleman vs Persita Tangerang'), ('31012017063504', '2017-01-31', 50000, 141220349, 'PSS Sleman vs PSIS Semarang'), ('31012017084123', '2017-01-31', 50000, 141220350, 'PSS Sleman vs PSIS Semarang'), ('31012017090956', '2017-01-31', 50000, 141220351, 'PSS Sleman vs Persija Jakarta'), ('31012017091305', '2017-01-31', 25000, 141220352, 'PSS Sleman vs Persija Jakarta'), ('01022017013828', '2017-02-01', 100000, 141220354, 'PSS Sleman vs Persija Jakarta'), ('01022017041240', '2017-02-01', 50000, 141220355, 'PSS Sleman vs Persija Jakarta'), ('01022017045918', '2017-02-01', 60000, 141220356, 'PSS Sleman vs Persija Jakarta'), ('01022017063846', '2017-02-01', 0, 0, 'PSS Sleman vs Persija Jakarta'), ('01022017063859', '2017-02-01', 0, 0, 'PSS Sleman vs Persija Jakarta'), ('01022017064033', '2017-02-01', 0, 0, 'PSS Sleman vs Persija Jakarta'), ('01022017064052', '2017-02-01', 0, 0, 'PSS Sleman vs Persija Jakarta'), ('06022017032704', '2017-02-06', 40000, 141220358, 'PSS Sleman vs PSIS Semarang'), ('07022017063859', '2017-02-07', 60000, 141220360, 'PSS Sleman vs PSIS Semarang'), ('07022017070214', '2017-02-07', 60000, 141220361, 'PSS Sleman vs PSIS Semarang'), ('09022017022234', '2017-02-09', 50000, 141220362, 'PSS Sleman vs PSIS Semarang'); -- -------------------------------------------------------- -- -- Table structure for table `jadwal` -- CREATE TABLE IF NOT EXISTS `jadwal` ( `kode_jadwal` int(1) NOT NULL AUTO_INCREMENT, `gambar` varchar(100) NOT NULL, `keterangan` varchar(50) NOT NULL, `tanggal` date NOT NULL, `status` varchar(11) NOT NULL, PRIMARY KEY (`kode_jadwal`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=58 ; -- -- Dumping data for table `jadwal` -- INSERT INTO `jadwal` (`kode_jadwal`, `gambar`, `keterangan`, `tanggal`, `status`) VALUES (48, 'persebaya.jpg', 'PSS Sleman vs Persebaya Surabaya', '2017-03-18', 'Aktif'), (49, 'persija.jpg', 'PSS Sleman vs Persija Jakarta', '2017-03-04', 'Tidak Aktif'), (50, 'persita.jpg', 'PSS Sleman vs Persita Tangerang', '2017-03-11', 'Tidak Aktif'), (52, 'persib.jpg', 'PSS Sleman vs Persib Bandung', '2017-04-01', 'Tidak Aktif'), (53, 'persipura.jpg', 'PSS Sleman vs Persipura Jayapura', '2017-03-25', 'Tidak Aktif'), (55, 'psis.jpg', 'PSS Sleman vs PSIS Semarang', '2017-04-08', 'Tidak Aktif'); -- -------------------------------------------------------- -- -- Table structure for table `konfirmasi` -- CREATE TABLE IF NOT EXISTS `konfirmasi` ( `kode_konfirmasi` int(5) NOT NULL AUTO_INCREMENT, `pemesanan` varchar(16) NOT NULL, `kode_bayar` varchar(20) NOT NULL, `jml_transfer` int(6) NOT NULL, `gambar` varchar(100) NOT NULL, `tgl_konfirmasi` date NOT NULL, `jadwal` varchar(50) NOT NULL, PRIMARY KEY (`kode_konfirmasi`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=88 ; -- -- Dumping data for table `konfirmasi` -- INSERT INTO `konfirmasi` (`kode_konfirmasi`, `pemesanan`, `kode_bayar`, `jml_transfer`, `gambar`, `tgl_konfirmasi`, `jadwal`) VALUES (38, '141220276', '29122016122208', 40000, 'bukti1.jpg', '2016-12-29', 'PSS Sleman vs Persija Jakarta'), (39, '141220277', '29122016010702', 50000, 'bukti3.jpg', '2016-12-29', 'PSS Sleman vs Persija Jakarta'), (40, '141220278', '29122016010822', 150000, 'bukti1.jpg', '2016-12-29', 'PSS Sleman vs Persija Jakarta'), (41, '141220279', '29122016011010', 40000, 'bukti4.jpg', '2016-12-29', 'PSS Sleman vs Persija Jakarta'), (42, '141220280', '29122016012329', 60000, 'bukti2.jpg', '2016-12-29', 'PSS Sleman vs Persija Jakarta'), (43, '141220286', '03012017105023', 50000, 'bukti3.jpg', '2017-01-03', 'PSS Sleman vs Persija Jakarta'), (44, '141220275', '03012017123938', 150000, 'bukti1.jpg', '2017-01-03', 'PSS Sleman vs Persija Jakarta'), (45, '141220274', '03012017124010', 30000, 'bukti4.jpg', '2017-01-03', 'PSS Sleman vs Persija Jakarta'), (46, '141220273', '03012017124110', 100000, 'bukti5.jpg', '2017-01-03', 'PSS Sleman vs Persija Jakarta'), (47, '141220265', '03012017124148', 100000, 'bukti3.jpg', '2017-01-03', 'PSS Sleman vs Persija Jakarta'), (48, '141220261', '03012017124238', 30000, 'bukti4.jpg', '2017-01-03', 'PSS Sleman vs Persija Jakarta'), (49, '141220251', '03012017124253', 40000, 'bukti2.jpg', '2017-01-03', 'PSS Sleman vs Persija Jakarta'), (50, '141220249', '03012017124400', 30000, 'bukti2.jpg', '2017-01-03', 'PSS Sleman vs Persija Jakarta'), (51, '141220245', '03012017124531', 60000, 'bukti2.jpg', '2017-01-03', 'PSS Sleman vs Persija Jakarta'), (52, '141220290', '03012017021921', 20000, 'bukti3.jpg', '2017-01-03', 'PSS Sleman vs Persija Jakarta'), (53, '141220291', '03012017023907', 50000, 'bukti1.jpg', '2017-01-03', ' PSS Sleman vs Persebaya Surabaya '), (54, '141220292', '03012017024509', 40000, 'bukti4.jpg', '2017-01-03', ' PSS Sleman vs Persija Jakarta '), (55, '141220295', '04012017120645', 40000, 'bukti3.jpg', '2017-01-04', 'PSS Sleman vs Persebaya Surabaya'), (56, '141220297', '04012017045312', 50000, 'bukti2.jpg', '2017-01-04', 'PSS Sleman vs Persebaya Surabaya'), (57, '141220298', '04012017054011', 50000, 'bukti2.jpg', '2017-01-04', 'PSS Sleman vs Persebaya Surabaya'), (58, '141220299', '04012017062245', 20000, 'bukti1.jpg', '2017-01-04', 'PSS Sleman vs Persebaya Surabaya'), (59, '141220300', '04012017065554', 30000, 'bukti4.jpg', '2017-01-04', 'PSS Sleman vs Persebaya Surabaya'), (60, '141220302', '04012017083836', 50000, 'bukti5.jpg', '2017-01-04', 'PSS Sleman vs Persebaya Surabaya'), (61, '141220303', '05012017104045', 50000, 'bukti2.jpg', '2017-01-05', 'PSS Sleman vs Persija Jakarta'), (62, '141220336', '05012017021138', 40000, 'bukti3.jpg', '2017-01-05', 'PSS Sleman vs Persija Jakarta'), (63, '141220337', '05012017023443', 90000, 'bukti3.jpg', '2017-01-05', 'PSS Sleman vs Persija Jakarta'), (65, '141220340', '10012017065615', 20000, 'bukti2.jpg', '2017-01-10', 'PSS Sleman vs Persita Tangerang'), (66, '141220341', '16012017084438', 150000, 'bukti4.jpg', '2017-01-16', 'PSS Sleman vs Persita Tangerang'), (67, '141220342', '16012017092818', 40000, 'bukti1.jpg', '2017-01-16', 'PSS Sleman vs Persita Tangerang'), (68, '141220343', '24012017083652', 50000, 'bukti2.jpg', '2017-01-24', 'PSS Sleman vs Persita Tangerang'), (69, '141220345', '24012017103335', 50000, 'bukti5.jpg', '2017-01-24', 'PSS Sleman vs Persita Tangerang'), (70, '141220346', '24012017104019', 50000, 'bukti3.jpg', '2017-01-24', 'PSS Sleman vs Persita Tangerang'), (71, '141220347', '30012017125014', 20000, 'bukti2.jpg', '2017-01-30', 'PSS Sleman vs Persita Tangerang'), (72, '141220348', '30012017080135', 60000, 'bukti3.jpg', '2017-01-30', 'PSS Sleman vs Persita Tangerang'), (73, '141220349', '31012017063504', 50000, 'bukti4.jpg', '2017-01-31', 'PSS Sleman vs PSIS Semarang'), (74, '141220350', '31012017084123', 50000, 'bukti2.jpg', '2017-01-31', 'PSS Sleman vs PSIS Semarang'), (75, '141220351', '31012017090956', 50000, 'bukti2.jpg', '2017-01-31', 'PSS Sleman vs Persija Jakarta'), (76, '141220352', '31012017091305', 25000, 'bukti2.jpg', '2017-01-31', 'PSS Sleman vs Persija Jakarta'), (77, '141220354', '01022017013828', 100000, 'bukti3.jpg', '2017-02-01', 'PSS Sleman vs Persija Jakarta'), (78, '141220355', '01022017041240', 50000, 'bukti1.jpg', '2017-02-01', 'PSS Sleman vs Persija Jakarta'), (79, '141220356', '01022017045918', 60000, 'bukti3.jpg', '2017-02-01', 'PSS Sleman vs Persija Jakarta'), (80, '', '01022017063846', 0, '', '2017-02-01', 'PSS Sleman vs Persija Jakarta'), (81, '', '01022017063859', 0, '', '2017-02-01', 'PSS Sleman vs Persija Jakarta'), (82, '', '01022017064033', 0, '', '2017-02-01', 'PSS Sleman vs Persija Jakarta'), (83, '', '01022017064052', 0, '', '2017-02-01', 'PSS Sleman vs Persija Jakarta'), (84, '141220358', '06022017032704', 40000, 'bukti2.jpg', '2017-02-06', 'PSS Sleman vs PSIS Semarang'), (85, '141220360', '07022017063859', 60000, 'bukti1.jpg', '2017-02-07', 'PSS Sleman vs PSIS Semarang'), (86, '141220361', '07022017070214', 60000, 'bukti2.jpg', '2017-02-07', 'PSS Sleman vs PSIS Semarang'), (87, '141220362', '09022017022234', 50000, 'bukti2.jpg', '2017-02-09', 'PSS Sleman vs PSIS Semarang'); -- -------------------------------------------------------- -- -- Table structure for table `penonton` -- CREATE TABLE IF NOT EXISTS `penonton` ( `id_penonton` varchar(16) NOT NULL, `nama` varchar(50) NOT NULL, `username` varchar(10) NOT NULL, `password` varchar(10) NOT NULL, PRIMARY KEY (`id_penonton`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -- Dumping data for table `penonton` -- INSERT INTO `penonton` (`id_penonton`, `nama`, `username`, `password`) VALUES ('<PASSWORD>', '<NAME>', '<PASSWORD>', '<PASSWORD>'), ('133110044', 'Yogo Prasetya', 'yogo', 'yogo'), ('133110045', '<NAME>', 'arto', 'arto'), ('133110046', '<NAME>', 'diah', 'diah'), ('133110047', '<NAME>', 'dwi', 'dwi'), ('133110057', '<NAME>', 'agus', 'agus'), ('133110049', '<NAME>', 'dewa', 'dewa'), ('133110050', '<NAME>', 'sigit', 'sigit'), ('133110051', '<NAME>', 'sela', 'sela'), ('133110052', '<NAME>', 'andre', 'andre'), ('133110054', '<NAME>', 'susilo', 'susilo'), ('133110055', '<NAME>', 'mark', 'mark'), ('133110056', '<NAME>', 'volta', 'volta'), ('135410037', '<NAME>', 'aji', 'aji'), ('133210013', '<NAME>', 'FA', 'qwertyui'), ('133110058', '<NAME>', 'younglex', 'younglex'), ('085729096048', '<NAME>', 'iwanfals', 'iwanfals'), ('123456789', '<NAME>', 'agussalim', 'agussalim'); -- -------------------------------------------------------- -- -- Table structure for table `pesan` -- CREATE TABLE IF NOT EXISTS `pesan` ( `kode_pesan` int(16) NOT NULL AUTO_INCREMENT, `status` varchar(11) DEFAULT 'Belum Bayar', `id_penonton` varchar(16) NOT NULL, `jumlah` int(1) NOT NULL, `kode_tiket` varchar(7) NOT NULL, `tgl_pesan` date NOT NULL, `jadwal` varchar(50) NOT NULL, `tanggal` date NOT NULL, PRIMARY KEY (`kode_pesan`), KEY `id_penonton` (`id_penonton`), KEY `id_penonton_2` (`id_penonton`), KEY `id_penonton_3` (`id_penonton`), KEY `id_penonton_4` (`id_penonton`), KEY `id_penonton_5` (`id_penonton`), KEY `id_penonton_6` (`id_penonton`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=141220363 ; -- -- Dumping data for table `pesan` -- INSERT INTO `pesan` (`kode_pesan`, `status`, `id_penonton`, `jumlah`, `kode_tiket`, `tgl_pesan`, `jadwal`, `tanggal`) VALUES (141220245, 'Bayar', '133110054', 3, 'Utara', '2016-12-19', 'PSS Sleman vs Persija Jakarta', '2017-03-04'), (141220249, 'Bayar', '133110055', 1, 'Timur', '2016-12-20', 'PSS Sleman vs Persija Jakarta', '2017-03-04'), (141220251, 'Bayar', '133110043', 2, 'Utara', '2016-12-21', 'PSS Sleman vs Persija Jakarta', '2017-03-04'), (141220261, 'Bayar', '133110043', 1, 'Timur', '2016-12-24', 'PSS Sleman vs Persija Jakarta', '2017-03-04'), (141220265, 'Bayar', '133110044', 2, 'Barat', '2016-12-28', 'PSS Sleman vs Persija Jakarta', '2017-03-04'), (141220273, 'Bayar', '133110043', 2, 'Barat', '2016-12-28', 'PSS Sleman vs Persija Jakarta', '2017-03-04'), (141220274, 'Bayar', '133110057', 1, 'Timur', '2016-12-28', 'PSS Sleman vs Persija Jakarta', '2017-03-04'), (141220275, 'Bayar', '133110057', 3, 'Barat', '2016-12-29', 'PSS Sleman vs Persija Jakarta', '2017-03-04'), (141220276, 'Bayar', '133110049', 2, 'Selatan', '2016-12-29', 'PSS Sleman vs Persija Jakarta', '2017-03-04'), (141220277, 'Bayar', '133110049', 1, 'Barat', '2016-12-29', 'PSS Sleman vs Persija Jakarta', '2017-03-04'), (141220278, 'Bayar', '133110044', 3, 'Barat', '2016-12-29', 'PSS Sleman vs Persija Jakarta', '2017-03-04'), (141220279, 'Bayar', '133110047', 2, 'Selatan', '2016-12-29', 'PSS Sleman vs Persija Jakarta', '2017-03-04'), (141220280, 'Bayar', '133110055', 3, 'Utara', '2016-12-29', 'PSS Sleman vs Persija Jakarta', '2017-03-04'), (141220281, 'Belum Bayar', '133110043', 3, 'Utara', '2016-12-29', 'PSS Sleman vs Persija Jakarta', '2017-03-04'), (141220286, 'Bayar', '133110051', 2, 'Timur', '2017-01-03', 'PSS Sleman vs Persija Jakarta', '2017-03-04'), (141220289, 'Belum Bayar', '133110054', 1, 'Barat', '2017-01-03', 'PSS Sleman vs Persija Jakarta', '2017-03-04'), (141220290, 'Bayar', '133110046', 1, 'Utara', '2017-01-03', 'PSS Sleman vs Persija Jakarta', '2017-03-04'), (141220291, 'Bayar', '133110047', 2, 'Timur', '2017-01-03', ' PSS Sleman vs Persebaya Surabaya ', '2017-03-18'), (141220292, 'Bayar', '133110049', 2, 'Selatan', '2017-01-03', ' PSS Sleman vs Persija Jakarta ', '2017-03-04'), (141220293, 'Belum Bayar', '133110051', 2, 'Timur', '2017-01-04', 'PSS Sleman vs Persebaya Surabaya', '2017-03-18'), (141220294, 'Belum Bayar', '133110051', 3, 'Timur', '2017-01-04', 'PSS Sleman vs Persebaya Surabaya', '2017-03-18'), (141220295, 'Bayar', '135410037', 2, 'Selatan', '2017-01-04', 'PSS Sleman vs Persebaya Surabaya', '2017-03-18'), (141220296, 'Belum Bayar', '135410037', 1, 'Barat', '2017-01-04', 'PSS Sleman vs Persebaya Surabaya', '2017-03-18'), (141220297, 'Bayar', '133110056', 1, 'Barat', '2017-01-04', 'PSS Sleman vs Persebaya Surabaya', '2017-03-18'), (141220298, 'Bayar', '133110044', 2, 'Timur', '2017-01-04', 'PSS Sleman vs Persebaya Surabaya', '2017-03-18'), (141220299, 'Bayar', '133110055', 1, 'Selatan', '2017-01-04', 'PSS Sleman vs Persebaya Surabaya', '2017-03-18'), (141220300, 'Bayar', '133110054', 1, 'Timur', '2017-01-04', 'PSS Sleman vs Persebaya Surabaya', '2017-03-18'), (141220301, 'Belum Bayar', '133110046', 2, 'Utara', '2017-01-04', 'PSS Sleman vs Persebaya Surabaya', '2017-03-18'), (141220302, 'Bayar', '133210013', 2, 'Barat', '2017-01-04', 'PSS Sleman vs Persebaya Surabaya', '2017-03-18'), (141220303, 'Bayar', '133110043', 2, 'Timur', '2017-01-05', 'PSS Sleman vs Persija Jakarta', '2017-03-04'), (141220336, 'Belum Bayar', '133110055', 2, 'Selatan', '2017-01-05', 'PSS Sleman vs Persija Jakarta', '2017-03-04'), (141220337, 'Bayar', '133110047', 3, 'Timur', '2017-01-05', 'PSS Sleman vs Persija Jakarta', '2017-03-04'), (141220338, 'Belum Bayar', '133110046', 1, 'Timur', '2017-01-05', 'PSS Sleman vs Persita Tangerang', '2017-03-11'), (141220340, 'Bayar', '133110058', 1, 'Utara', '2017-01-10', 'PSS Sleman vs Persita Tangerang', '2017-03-11'), (141220341, 'Bayar', '133110057', 3, 'Barat', '2017-01-16', 'PSS Sleman vs Persita Tangerang', '2017-03-11'), (141220342, 'Bayar', '133110043', 2, 'Utara', '2017-01-16', 'PSS Sleman vs Persita Tangerang', '2017-03-11'), (141220343, 'Bayar', '133110043', 1, 'Barat', '2017-01-24', 'PSS Sleman vs Persita Tangerang', '2017-03-11'), (141220344, 'Belum Bayar', '133110051', 1, 'Barat', '2017-01-24', 'PSS Sleman vs Persebaya Surabaya', '2017-03-18'), (141220345, 'Bayar', '133110044', 1, 'Barat', '2017-01-24', 'PSS Sleman vs Persebaya Surabaya', '2017-03-18'), (141220346, 'Bayar', '133110058', 1, 'Barat', '2017-01-24', 'PSS Sleman vs Persija Jakarta', '2017-03-04'), (141220347, 'Bayar', '133110047', 1, 'Utara', '2017-01-30', 'PSS Sleman vs Persija Jakarta', '2017-03-04'), (141220348, 'Bayar', '085729096048', 3, 'Utara', '2017-01-30', 'PSS Sleman vs Persija Jakarta', '2017-03-04'), (141220349, 'Bayar', '085729096048', 1, 'Barat', '2017-01-31', 'PSS Sleman vs Persib Bandung', '2017-04-01'), (141220350, 'Bayar', '123456789', 2, 'Barat', '2017-01-31', 'PSS Sleman vs Persija Jakarta', '2017-03-04'), (141220351, 'Belum Bayar', '133110043', 1, 'Barat', '2017-01-31', 'PSS Sleman vs PSIS Semarang', '2017-04-08'), (141220352, 'Belum Bayar', '133110047', 1, 'Timur', '2017-01-31', 'PSS Sleman vs PSIS Semarang', '2017-04-08'), (141220353, 'Belum Bayar', '133110047', 2, 'Barat', '2017-01-31', 'PSS Sleman vs PSIS Semarang', '2017-04-08'), (141220354, 'Bayar', '133110043', 2, 'Barat', '2017-02-01', 'PSS Sleman vs PSIS Semarang', '2017-04-08'), (141220355, 'Bayar', '133110047', 1, 'Barat', '2017-02-01', 'PSS Sleman vs PSIS Semarang', '2017-04-08'), (141220356, 'Bayar', '133110045', 3, 'Utara', '2017-02-01', 'PSS Sleman vs PSIS Semarang', '2017-04-08'), (141220357, 'Belum Bayar', '133110049', 3, 'Barat', '2017-02-01', 'PSS Sleman vs PSIS Semarang', '2017-04-08'), (141220358, 'Belum Bayar', '133110043', 2, 'Utara', '2017-02-06', 'PSS Sleman vs Persebaya Surabaya', '2017-03-18'), (141220359, 'Belum Bayar', '133110043', 3, 'Barat', '2017-02-07', 'PSS Sleman vs Persebaya Surabaya', '2017-03-18'), (141220360, 'Bayar', '133110051', 3, 'Utara', '2017-02-07', 'PSS Sleman vs Persija Jakarta', '2017-03-04'), (141220361, 'Bayar', '133110045', 3, 'Selatan', '2017-02-07', 'PSS Sleman vs Persija Jakarta', '2017-03-04'), (141220362, 'Belum Bayar', '133110043', 1, 'Barat', '2017-02-09', 'PSS Sleman vs Persija Jakarta', '2017-03-04'); -- -------------------------------------------------------- -- -- Table structure for table `tiket` -- CREATE TABLE IF NOT EXISTS `tiket` ( `kode_tiket` varchar(7) NOT NULL, `harga` int(5) NOT NULL, `stok` int(4) NOT NULL, `tribun` varchar(6) NOT NULL, PRIMARY KEY (`kode_tiket`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -- Dumping data for table `tiket` -- INSERT INTO `tiket` (`kode_tiket`, `harga`, `stok`, `tribun`) VALUES ('Timur', 25000, 978, 'Merah'), ('Barat', 50000, 961, 'Biru'), ('Selatan', 20000, 986, 'Kuning'), ('Utara', 20000, 971, 'Hijau'); /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
#!/bin/sh set -eu npm --version npm install npm run build -- --prod #npm run build cd dist tar zcvf dist.tar.gz * mv dist.tar.gz ../docker/nginx/ cd ../docker/nginx chmod -R a+x *.sh
import re def extract_email(string): emails = re.findall(r"[\w\.-]+@[\w\.-]+", string) return emails string = "My email is abc@gmail.com" extract_email(string) # ['abc@gmail.com']
# create bytecode vyper -f bytecode wallet.vy > wallet.bin cat wallet.bin # create ABI vyper -f abi wallet.vy > wallet.abi cat wallet.abi
<filename>config/boot.rb # Interfaces must be required, can't autoload require "c99/ate_interface" # The majority of this class is defined in the support application, # this is to test that the importing application can override and # extend imported classes. require_relative "../lib/c99/nvm" require_relative "../helpers/guides"
#!/bin/bash export PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin" # Date: 01:17 2018-04-07 # Author: Created by Jeson # Mail: 309769163@qq.com # Funcsion:This scripts funcsion is php-5.6.35.tar.gz install ############## 记录日志用的变量 FaShongDuan_Host_IP=${2} Local_Rsync_Password=$(eval echo "/etc/rsync.password") LocalHost_IP=`ifconfig eth0|sed -rn '2s/^.*ddr:(.*) B.*$/\1/p'` Time=$(date +%F\ %T) Log_name=php-5.6.35.tar.gz Path_Intall_log_ok=~/Log/${Log_name}_Intall_ok.log Path_Intall_log_false=~/Log/${Log_name}_Intall_false.log ############## 记录日志用的变量 mkdir -p /application/tar_xzf ~/Log /backup /server/{scripts,tools} yum -y install libcurl-devel zlib-devel libxml2-devel libjpeg-turbo-devel freetype-devel libpng-devel \ gd-devel libxslt-devel libmcrypt-devel mhash mhash-devel mcrypt libcurl-devel openssl-devel bzip2-devel cd /server/scripts && wget http://yum.etiantian.org/tar.gzs/libiconv-1.14.tar.gz wget http://yum.etiantian.org/tar.gzs/php-5.6.35.tar.gz tar zxf /server/scripts/libiconv-1.14.tar.gz -C /application/tar_xzf cd /application/tar_xzf/libiconv-1.14 ./configure --prefix=/usr/local/libiconv && make -j 4 && make install # 安装PHP主程序 tar zxf /server/scripts/php-5.6.35.tar.gz -C /application/tar_xzf cd /application/tar_xzf/php-5.6.35 ./configure \ --prefix=/application/php-5.6.35 \ --with-mysql=mysqlnd \ --with-mysqli=mysqlnd \ --with-pdo-mysql=mysqlnd \ --with-iconv-dir=/usr/local/libiconv \ --with-freetype-dir \ --with-jpeg-dir \ --with-png-dir \ --with-zlib \ --with-libxml-dir=/usr \ --enable-xml \ --disable-rpath \ --enable-bcmath \ --enable-shmop \ --enable-sysvsem \ --enable-inline-optimization \ --with-curl \ --enable-mbregex \ --enable-fpm \ --enable-mbstring \ --with-mcrypt \ --with-gd \ --enable-gd-native-ttf \ --with-openssl \ --with-mhash \ --enable-pcntl \ --enable-sockets \ --with-xmlrpc \ --enable-soap \ --enable-short-tags \ --enable-static \ --with-xsl \ --with-fpm-user=nginx \ --with-fpm-group=nginx \ --enable-zip \ --with-bz2 \ --enable-ftp \ --with-apxs2=/application/apache/bin/apxs \ #--enable-opcache #操作码缓存 # 安装PHP主程序前要做的 rm -f /usr/lib64/libmysqlclient.so.18 ln -s /application/mysql/lib/libmysqlclient.so.18 /usr/lib64/ touch ext/phar/phar.phar make -j 4 && make install RETVAL=$? [ -x /application/php ] && rm -fr /application/php ln -s /application/php-5.6.35/ /application/php # 生产环境用: # cp -ab php.ini-production /application/php/lib/php.ini # 测试环境用: /bin/cp -ab /Apache-web-server/conf/php.ini /application/php/lib/php.ini # 创建php-fpm.conf配置文件 /bin/cp -ab /Apache-web-server/conf/php-fpm.conf /application/php/etc/php-fpm.conf mkdir -p /application/php-5.6.35/log touch /application/php-5.6.35/log/www.log.slow # 装完 PHP主程序 以后加上这句,装”touch ext/phar/phar.phar”的真实文件 # /application/php/bin/php /server/tools/go-pear.phar yum -y install expect cd /server/scripts && wget http://yum.etiantian.org/tar.gzs/go-pear.phar /bin/cp -ab /Apache-web-server/scripts/phar_install.exp /server/scripts expect /server/scripts/phar_install.exp ############# 记录安装日志,并发送到客户端 if [ 0 -eq ${RETVAL} ];then echo "Remote Intall [ ${Log_name} ] to $USER@$LocalHost_IP --- [ OK ] ${Time}">>${Path_Intall_log_ok}_${LocalHost_IP} else echo "Remote Intall [ ${Log_name} ] to $USER@$LocalHost_IP --- [ false ] ${Time}">>${Path_Intall_log_false}_${LocalHost_IP} fi rsync -az --password-file=${Local_Rsync_Password} \ $(eval echo "~/Log") rsync_backup@${FaShongDuan_Host_IP}::Log_Backup
package com.surveyapp.backend.persistence.repositories; import com.surveyapp.backend.persistence.domain.backend.QuestionOption; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; @Repository public interface OptionRepository extends CrudRepository<QuestionOption, Integer>{ }
#include <stdlib.h> // ORACLE VOID foo(VOID) void foo(void) { int a, b; int i; a = rand() % 65536; b = rand() % 65536; for (i = 0; i < b; i++) a += b; // to avoid warning i = a; return; } int main(void) { int i; for (i = 0; i < (rand() % 65536); i++) foo(); return 0; }
<filename>client/components/CartItem.js import React from 'react' import {Link} from 'react-router-dom' import { removeFromCartThunk, updateCartThunk, updateGuestCart, removeFromGuestCart } from '../store/cart' import {connect} from 'react-redux' import history from '../history' const CartItem = props => { const total = props.item.price * props.item.quantity / 100 const filmData = JSON.parse(window.localStorage.cart)[props.idx] const whatever = () => { if (props.cart.length <= 1) { window.localStorage.clear() history.push('/orders/cart') } } return ( <div> {props.user.id ? ( props.filmInfo ? ( <div> {' '} <img src={props.filmInfo.imageUrl} /> <p>{props.filmInfo.title}</p>{' '} </div> ) : ( 'Image Unavailable' ) ) : ( <div> {' '} <img src={filmData.imageUrl} /> <p>{filmData.title}</p>{' '} </div> )} <p>Total Price: ${total}</p> <form onSubmit={evt => { evt.preventDefault() const newProps = { ...props.item, quantity: evt.target.quantity_input.value } props.user.id ? props.updateCartThunk(newProps) : props.updateGuestCart(newProps) window.localStorage.setItem('cart', JSON.stringify(props.cart)) }} > Qty:{' '} <input type="number" name="quantity" min="1" defaultValue={props.item.quantity} id="quantity_input" />{' '} <button type="submit">Update</button> </form> <div> {props.user.id ? ( <button type="button" onClick={() => props.removeFromCartThunk(props.item)} > Remove </button> ) : ( <button type="button" onClick={() => { whatever() props.removeFromGuestCart(props.item) console.log(props.item, 'props.item') props.cart.length > 0 ? console.log('') : window.localStorage.setItem('cart', '{}') }} > Remove </button> )} </div> </div> ) } const mapStateToProps = state => { return { user: state.user, cart: state.cart.cart } } const mapDispatchToProps = dispatch => { return { removeFromCartThunk: item => dispatch(removeFromCartThunk(item)), removeFromGuestCart: item => dispatch(removeFromGuestCart(item)), updateCartThunk: item => dispatch(updateCartThunk(item)), updateGuestCart: item => dispatch(updateGuestCart(item)) } } export default connect(mapStateToProps, mapDispatchToProps)(CartItem)
import type { FractureRuleType } from "../../types/css-rules"; // prettier-ignore export const height: Array<FractureRuleType> = [ { selector: 'h-0', declarations: { height: 0 }, hasBreakpoints: true }, { selector: 'h-viewport', declarations: { height: '100vh' }, hasBreakpoints: true, description: 'Height is 100 viewport height.' }, { selector: 'h-px', declarations: { height: 'var(--box-px)' }, hasBreakpoints: true }, { selector: 'h-1', declarations: { height: 'var(--box-1)' }, hasBreakpoints: true }, { selector: 'h-2', declarations: { height: 'var(--box-2)' }, hasBreakpoints: true }, { selector: 'h-3', declarations: { height: 'var(--box-3)' }, hasBreakpoints: true }, { selector: 'h-4', declarations: { height: 'var(--box-4)' }, hasBreakpoints: true }, { selector: 'h-5', declarations: { height: 'var(--box-5)' }, hasBreakpoints: true }, { selector: 'h-6', declarations: { height: 'var(--box-6)' }, hasBreakpoints: true }, { selector: 'h-7', declarations: { height: 'var(--box-7)' }, hasBreakpoints: true }, { selector: 'h-8', declarations: { height: 'var(--box-8)' }, hasBreakpoints: true }, { selector: 'h-9', declarations: { height: 'var(--box-9)' }, hasBreakpoints: true }, { selector: 'h-10', declarations: { height: 'var(--box-10)' }, hasBreakpoints: true }, { selector: 'h-11', declarations: { height: 'var(--box-11)' }, hasBreakpoints: true }, { selector: 'h-11', declarations: { height: 'var(--box-11)' }, hasBreakpoints: true }, { selector: 'h-12', declarations: { height: 'var(--box-12)' }, hasBreakpoints: true }, { selector: 'h-12', declarations: { height: 'var(--box-12)' }, hasBreakpoints: true }, { selector: 'h-13', declarations: { height: 'var(--box-13)' }, hasBreakpoints: true }, { selector: 'h-13', declarations: { height: 'var(--box-13)' }, hasBreakpoints: true }, { selector: 'h-14', declarations: { height: 'var(--box-14)' }, hasBreakpoints: true }, { selector: 'h-14', declarations: { height: 'var(--box-14)' }, hasBreakpoints: true }, { selector: 'h-15', declarations: { height: 'var(--box-15)' }, hasBreakpoints: true }, { selector: 'h-15', declarations: { height: 'var(--box-15)' }, hasBreakpoints: true }, { selector: 'h-16', declarations: { height: 'var(--box-16)' }, hasBreakpoints: true }, { selector: 'h-24', declarations: { height: 'var(--box-24)' }, hasBreakpoints: true }, { selector: 'h-32', declarations: { height: 'var(--box-32)' }, hasBreakpoints: true }, { selector: 'h-40', declarations: { height: 'var(--box-40)' }, hasBreakpoints: true }, { selector: 'h-48', declarations: { height: 'var(--box-48)' }, hasBreakpoints: true }, { selector: 'hp-10', declarations: { height: '10%' }, hasBreakpoints: true }, { selector: 'hp-15', declarations: { height: '15%' }, hasBreakpoints: true }, { selector: 'hp-20', declarations: { height: '20%' }, hasBreakpoints: true }, { selector: 'hp-25', declarations: { height: '25%' }, hasBreakpoints: true }, { selector: 'hp-30', declarations: { height: '30%' }, hasBreakpoints: true }, { selector: 'hp-33', declarations: { height: 'calc(100%/3)' }, hasBreakpoints: true }, { selector: 'hp-35', declarations: { height: '35%' }, hasBreakpoints: true }, { selector: 'hp-40', declarations: { height: '40%' }, hasBreakpoints: true }, { selector: 'hp-45', declarations: { height: '45%' }, hasBreakpoints: true }, { selector: 'hp-50', declarations: { height: '50%' }, hasBreakpoints: true }, { selector: 'hp-55', declarations: { height: '55%' }, hasBreakpoints: true }, { selector: 'hp-60', declarations: { height: '60%' }, hasBreakpoints: true }, { selector: 'hp-66', declarations: { height: 'calc((100%/3)*2)' }, hasBreakpoints: true }, { selector: 'hp-65', declarations: { height: '65%' }, hasBreakpoints: true }, { selector: 'hp-70', declarations: { height: '70%' }, hasBreakpoints: true }, { selector: 'hp-75', declarations: { height: '75%' }, hasBreakpoints: true }, { selector: 'hp-80', declarations: { height: '80%' }, hasBreakpoints: true }, { selector: 'hp-85', declarations: { height: '85%' }, hasBreakpoints: true }, { selector: 'hp-90', declarations: { height: '90%' }, hasBreakpoints: true }, { selector: 'hp-95', declarations: { height: '95%' }, hasBreakpoints: true }, { selector: 'hp-100', declarations: { height: '100%' }, hasBreakpoints: true }, { selector: 'hmax-0', declarations: { maxHeight: 0 }, hasBreakpoints: true }, { selector: 'hmax-viewport', declarations: { maxHeight: '100vh' }, hasBreakpoints: true, description: 'Max height is 100 viewport height.' }, { selector: 'hmax-px', declarations: { maxHeight: 'var(--box-px)' }, hasBreakpoints: true }, { selector: 'hmax-1', declarations: { maxHeight: 'var(--box-1)' }, hasBreakpoints: true }, { selector: 'hmax-2', declarations: { maxHeight: 'var(--box-2)' }, hasBreakpoints: true }, { selector: 'hmax-3', declarations: { maxHeight: 'var(--box-3)' }, hasBreakpoints: true }, { selector: 'hmax-4', declarations: { maxHeight: 'var(--box-4)' }, hasBreakpoints: true }, { selector: 'hmax-5', declarations: { maxHeight: 'var(--box-5)' }, hasBreakpoints: true }, { selector: 'hmax-6', declarations: { maxHeight: 'var(--box-6)' }, hasBreakpoints: true }, { selector: 'hmax-7', declarations: { maxHeight: 'var(--box-7)' }, hasBreakpoints: true }, { selector: 'hmax-8', declarations: { maxHeight: 'var(--box-8)' }, hasBreakpoints: true }, { selector: 'hmax-9', declarations: { maxHeight: 'var(--box-9)' }, hasBreakpoints: true }, { selector: 'hmax-10', declarations: { maxHeight: 'var(--box-10)' }, hasBreakpoints: true }, { selector: 'hmax-11', declarations: { maxHeight: 'var(--box-11)' }, hasBreakpoints: true }, { selector: 'hmax-11', declarations: { maxHeight: 'var(--box-11)' }, hasBreakpoints: true }, { selector: 'hmax-12', declarations: { maxHeight: 'var(--box-12)' }, hasBreakpoints: true }, { selector: 'hmax-12', declarations: { maxHeight: 'var(--box-12)' }, hasBreakpoints: true }, { selector: 'hmax-13', declarations: { maxHeight: 'var(--box-13)' }, hasBreakpoints: true }, { selector: 'hmax-13', declarations: { maxHeight: 'var(--box-13)' }, hasBreakpoints: true }, { selector: 'hmax-14', declarations: { maxHeight: 'var(--box-14)' }, hasBreakpoints: true }, { selector: 'hmax-14', declarations: { maxHeight: 'var(--box-14)' }, hasBreakpoints: true }, { selector: 'hmax-15', declarations: { maxHeight: 'var(--box-15)' }, hasBreakpoints: true }, { selector: 'hmax-15', declarations: { maxHeight: 'var(--box-15)' }, hasBreakpoints: true }, { selector: 'hmax-16', declarations: { maxHeight: 'var(--box-16)' }, hasBreakpoints: true }, { selector: 'hmax-24', declarations: { maxHeight: 'var(--box-24)' }, hasBreakpoints: true }, { selector: 'hmax-32', declarations: { maxHeight: 'var(--box-32)' }, hasBreakpoints: true }, { selector: 'hmax-40', declarations: { maxHeight: 'var(--box-40)' }, hasBreakpoints: true }, { selector: 'hmax-48', declarations: { maxHeight: 'var(--box-48)' }, hasBreakpoints: true }, { selector: 'hpmax-15', declarations: { maxHeight: '15%' }, hasBreakpoints: true }, { selector: 'hpmax-10', declarations: { maxHeight: '10%' }, hasBreakpoints: true }, { selector: 'hpmax-20', declarations: { maxHeight: '20%' }, hasBreakpoints: true }, { selector: 'hpmax-25', declarations: { maxHeight: '25%' }, hasBreakpoints: true }, { selector: 'hpmax-30', declarations: { maxHeight: '30%' }, hasBreakpoints: true }, { selector: 'hpmax-33', declarations: { maxHeight: 'calc(100%/3)' }, hasBreakpoints: true }, { selector: 'hpmax-35', declarations: { maxHeight: '35%' }, hasBreakpoints: true }, { selector: 'hpmax-40', declarations: { maxHeight: '40%' }, hasBreakpoints: true }, { selector: 'hpmax-45', declarations: { maxHeight: '45%' }, hasBreakpoints: true }, { selector: 'hpmax-50', declarations: { maxHeight: '50%' }, hasBreakpoints: true }, { selector: 'hpmax-55', declarations: { maxHeight: '55%' }, hasBreakpoints: true }, { selector: 'hpmax-60', declarations: { maxHeight: '60%' }, hasBreakpoints: true }, { selector: 'hpmax-66', declarations: { maxHeight: 'calc((100%/3)*2)' }, hasBreakpoints: true }, { selector: 'hpmax-65', declarations: { maxHeight: '65%' }, hasBreakpoints: true }, { selector: 'hpmax-70', declarations: { maxHeight: '70%' }, hasBreakpoints: true }, { selector: 'hpmax-75', declarations: { maxHeight: '75%' }, hasBreakpoints: true }, { selector: 'hpmax-80', declarations: { maxHeight: '80%' }, hasBreakpoints: true }, { selector: 'hpmax-85', declarations: { maxHeight: '85%' }, hasBreakpoints: true }, { selector: 'hpmax-90', declarations: { maxHeight: '90%' }, hasBreakpoints: true }, { selector: 'hpmax-95', declarations: { maxHeight: '95%' }, hasBreakpoints: true }, { selector: 'hpmax-100', declarations: { maxHeight: '100%' }, hasBreakpoints: true }, { selector: 'hmin-0', declarations: { minHeight: 0 }, hasBreakpoints: true }, { selector: 'hmin-viewport', declarations: { minHeight: '100vh' }, hasBreakpoints: true, description: 'Min height is 100 viewport height.' }, { selector: 'hmin-px', declarations: { minHeight: 'var(--box-px)' }, hasBreakpoints: true }, { selector: 'hmin-1', declarations: { minHeight: 'var(--box-1)' }, hasBreakpoints: true }, { selector: 'hmin-2', declarations: { minHeight: 'var(--box-2)' }, hasBreakpoints: true }, { selector: 'hmin-3', declarations: { minHeight: 'var(--box-3)' }, hasBreakpoints: true }, { selector: 'hmin-4', declarations: { minHeight: 'var(--box-4)' }, hasBreakpoints: true }, { selector: 'hmin-5', declarations: { minHeight: 'var(--box-5)' }, hasBreakpoints: true }, { selector: 'hmin-6', declarations: { minHeight: 'var(--box-6)' }, hasBreakpoints: true }, { selector: 'hmin-7', declarations: { minHeight: 'var(--box-7)' }, hasBreakpoints: true }, { selector: 'hmin-8', declarations: { minHeight: 'var(--box-8)' }, hasBreakpoints: true }, { selector: 'hmin-9', declarations: { minHeight: 'var(--box-9)' }, hasBreakpoints: true }, { selector: 'hmin-10', declarations: { minHeight: 'var(--box-10)' }, hasBreakpoints: true }, { selector: 'hmin-11', declarations: { minHeight: 'var(--box-11)' }, hasBreakpoints: true }, { selector: 'hmin-11', declarations: { minHeight: 'var(--box-11)' }, hasBreakpoints: true }, { selector: 'hmin-12', declarations: { minHeight: 'var(--box-12)' }, hasBreakpoints: true }, { selector: 'hmin-12', declarations: { minHeight: 'var(--box-12)' }, hasBreakpoints: true }, { selector: 'hmin-13', declarations: { minHeight: 'var(--box-13)' }, hasBreakpoints: true }, { selector: 'hmin-13', declarations: { minHeight: 'var(--box-13)' }, hasBreakpoints: true }, { selector: 'hmin-14', declarations: { minHeight: 'var(--box-14)' }, hasBreakpoints: true }, { selector: 'hmin-14', declarations: { minHeight: 'var(--box-14)' }, hasBreakpoints: true }, { selector: 'hmin-15', declarations: { minHeight: 'var(--box-15)' }, hasBreakpoints: true }, { selector: 'hmin-15', declarations: { minHeight: 'var(--box-15)' }, hasBreakpoints: true }, { selector: 'hmin-16', declarations: { minHeight: 'var(--box-16)' }, hasBreakpoints: true }, { selector: 'hmin-24', declarations: { minHeight: 'var(--box-24)' }, hasBreakpoints: true }, { selector: 'hmin-32', declarations: { minHeight: 'var(--box-32)' }, hasBreakpoints: true }, { selector: 'hmin-40', declarations: { minHeight: 'var(--box-40)' }, hasBreakpoints: true }, { selector: 'hmin-48', declarations: { minHeight: 'var(--box-48)' }, hasBreakpoints: true }, { selector: 'hpmin-15', declarations: { minHeight: '15%' }, hasBreakpoints: true }, { selector: 'hpmin-10', declarations: { minHeight: '10%' }, hasBreakpoints: true }, { selector: 'hpmin-20', declarations: { minHeight: '20%' }, hasBreakpoints: true }, { selector: 'hpmin-25', declarations: { minHeight: '25%' }, hasBreakpoints: true }, { selector: 'hpmin-30', declarations: { minHeight: '30%' }, hasBreakpoints: true }, { selector: 'hpmin-33', declarations: { minHeight: 'calc(100%/3)' }, hasBreakpoints: true }, { selector: 'hpmin-35', declarations: { minHeight: '35%' }, hasBreakpoints: true }, { selector: 'hpmin-40', declarations: { minHeight: '40%' }, hasBreakpoints: true }, { selector: 'hpmin-45', declarations: { minHeight: '45%' }, hasBreakpoints: true }, { selector: 'hpmin-50', declarations: { minHeight: '50%' }, hasBreakpoints: true }, { selector: 'hpmin-55', declarations: { minHeight: '55%' }, hasBreakpoints: true }, { selector: 'hpmin-60', declarations: { minHeight: '60%' }, hasBreakpoints: true }, { selector: 'hpmin-66', declarations: { minHeight: 'calc((100%/3)*2)' }, hasBreakpoints: true }, { selector: 'hpmin-65', declarations: { minHeight: '65%' }, hasBreakpoints: true }, { selector: 'hpmin-70', declarations: { minHeight: '70%' }, hasBreakpoints: true }, { selector: 'hpmin-75', declarations: { minHeight: '75%' }, hasBreakpoints: true }, { selector: 'hpmin-80', declarations: { minHeight: '80%' }, hasBreakpoints: true }, { selector: 'hpmin-85', declarations: { minHeight: '85%' }, hasBreakpoints: true }, { selector: 'hpmin-90', declarations: { minHeight: '90%' }, hasBreakpoints: true }, { selector: 'hpmin-95', declarations: { minHeight: '95%' }, hasBreakpoints: true }, { selector: 'hpmin-100', declarations: { minHeight: '100%' }, hasBreakpoints: true }, ];
package ua.clinic.utils; import java.security.SecureRandom; import java.math.*; /** * @author <NAME> */ public final class IdGenerator { private static SecureRandom random = new SecureRandom(); public static Long newId() { return Math.abs(new BigInteger(20, random).longValue()); } }
package adb import ( "github.com/cnbattle/douyin/internal/config" "log" "time" ) func init() { log.Println("[ADB] start") } func Start() { START: start := time.Now().Unix() CloseApp(config.V.GetString("app.packageName")) RunApp(config.V.GetString("app.packageName") + "/" + config.V.GetString("app.startPath")) time.Sleep(10 * time.Second) for { now := time.Now().Unix() if now > start+config.V.GetInt64("app.restart") { time.Sleep(config.V.GetDuration("app.sleep") * time.Second) goto START } Click(config.V.GetString("click.x"), config.V.GetString("click.y")) time.Sleep(300 * time.Millisecond) Click(config.V.GetString("click.x"), config.V.GetString("click.y")) time.Sleep(config.V.GetDuration("click.sleep") * time.Second) } }
#!/bin/bash # Copyright 2020 Google # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # Example usage: # ./build_protos <path to nanopb> # Dependencies: git, protobuf, python-protobuf, pyinstaller readonly DIR="$( git rev-parse --show-toplevel )" # Current release of nanopb being used to build the CCT protos readonly NANOPB_VERSION="0.3.9.3" readonly NANOPB_TEMPDIR="${DIR}/Crashlytics/nanopb_temp" readonly LIBRARY_DIR="${DIR}/Crashlytics/Crashlytics/" readonly PROTO_DIR="${DIR}/Crashlytics/ProtoSupport/Protos/" readonly PROTOGEN_DIR="${DIR}/Crashlytics/Protogen/" rm -rf "${NANOPB_TEMPDIR}" echo "Downloading nanopb..." git clone --branch "${NANOPB_VERSION}" https://github.com/nanopb/nanopb.git "${NANOPB_TEMPDIR}" echo "Building nanopb..." pushd "${NANOPB_TEMPDIR}" ./tools/make_mac_package.sh GIT_DESCRIPTION=`git describe --always`-macosx-x86 NANOPB_BIN_DIR="dist/${GIT_DESCRIPTION}" popd echo "Removing existing CCT protos..." rm -rf "${PROTOGEN_DIR}/*" echo "Generating CCT protos..." python "${DIR}/Crashlytics/ProtoSupport/proto_generator.py" \ --nanopb \ --protos_dir="${PROTO_DIR}" \ --pythonpath="${NANOPB_TEMPDIR}/${NANOPB_BIN_DIR}/generator" \ --output_dir="${PROTOGEN_DIR}" \ --include="${PROTO_DIR}" rm -rf "${NANOPB_TEMPDIR}"
<gh_stars>0 // // SAMAppDelegate.h // SamosWallet // // Created by zys on 2018/8/18. // Copyright © 2018年 zys. All rights reserved. // #import <UIKit/UIKit.h> @interface SAMAppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @end
import { DISMISS_ERROR } from '../actions/dismissError'; import { INITIALISE } from '../actions/inititialise'; import { REGISTER_REQUEST, REGISTER_SUCESSS, REGISTER_FAILURE } from '../actions/register'; import { REGISTER2_REQUEST, REGISTER2_SUCESSS, REGISTER2_FAILURE } from '../actions/register2'; import { SESSION_REQUEST, SESSION_SUCCESS, SESSION_RESET, SESSION_FAILURE } from '../actions/session'; import { TOPUP_REQUEST, TOPUP_SUCCESS, TOPUP_FAILURE } from '../actions/topup'; import { PURCHASE_REQUEST, PURCHASE_SUCCESS, PURCHASE_FAILURE } from '../actions/purchase'; import { DESTROY_SESSION } from '../actions/destroy-session'; import { LOGOUT_REQUEST, LOGOUT_SUCCESS, LOGOUT_FAILURE } from '../actions/logout'; import { SUPPORT_REQUEST, SUPPORT_SUCCESS, SUPPORT_FAILURE } from '../actions/support'; import { SIGNIN_REQUEST, SIGNIN_SUCCESS, SIGNIN_FAILURE } from '../actions/signin'; import { SIGNIN2_REQUEST, SIGNIN2_SUCCESS, SIGNIN2_FAILURE } from '../actions/signin2'; import { STORE_REQUEST, STORE_SUCCESS, STORE_FAILURE } from '../actions/store'; import { MARKETPLACE_REQUEST, MARKETPLACE_SUCCESS, MARKETPLACE_FAILURE } from '../actions/marketplace'; import { UPDATE_STOCK_COUNT_REQUEST, UPDATE_STOCK_COUNT_SUCCESS, UPDATE_STOCK_COUNT_FAILURE } from '../actions/update-stock-count'; import { UNLIKE_ITEM, LIKE_ITEM } from '../actions/like-item'; import { LOCAL_STORAGE_SAVE_ERROR } from '../actions/save-error'; import { REFUND_REQUEST, REFUND_SUCCESS, REFUND_FAILURE } from '../actions/refund'; import { LOGGED_OUT_IN_ANOTHER_SESSION } from '../actions/logged-out'; import { ALL_ITEMS_REQUEST, ALL_ITEMS_SUCCESS, ALL_ITEMS_FAILURE } from '../actions/all-items'; import { UPDATE_ITEM_REQUEST, UPDATE_ITEM_SUCCESS, UPDATE_ITEM_FAILURE } from '../actions/update-item'; import { CREATE_ITEM_REQUEST, CREATE_ITEM_SUCCESS, CREATE_ITEM_FAILURE } from '../actions/create-item'; import { ALL_LISTINGS_REQUEST, ALL_LISTINGS_SUCCESS, ALL_LISTINGS_FAILURE } from '../actions/all-listings'; import { UPDATE_LISTING_COUNT_REQUEST, UPDATE_LISTING_COUNT_SUCCESS, UPDATE_LISTING_COUNT_FAILURE } from '../actions/update-listing-count'; import { UPDATE_LISTING_DETAILS_REQUEST, UPDATE_LISTING_DETAILS_SUCCESS, UPDATE_LISTING_DETAILS_FAILURE } from '../actions/update-listing-details'; import { CREATE_LISTING_REQUEST, CREATE_LISTING_SUCCESS, CREATE_LISTING_FAILURE } from '../actions/create-listing'; import { REMOVE_LISTING_REQUEST, REMOVE_LISTING_SUCCESS, REMOVE_LISTING_FAILURE } from '../actions/remove-listing'; import { RELIST_REQUEST, RELIST_SUCCESS, RELIST_FAILURE } from '../actions/relist'; import { getInitialState } from '../state'; const requestState = (requestId, updatedProps, state) => ({ ...state, ...updatedProps, pending: [...state.pending, requestId] }); const fullPageErrorState = (requestId, error, state) => ({ ...state, error: { ...state.error, fullPage: state.error.fullPage || error }, pending: state.pending.filter(e => e !== requestId) }); const completionState = (requestId, updatedProps, state) => ({ ...state, ...updatedProps, pending: state.pending.filter(e => e !== requestId) }); export default (state, action) => { switch (action.type) { case INITIALISE: { return { ...state, initialised: true }; } case DISMISS_ERROR: { return { ...state, error: { ...state.error, fullPage: undefined } }; } case REGISTER_REQUEST: return requestState('register', {}, state); case REGISTER_SUCESSS: return completionState('register', action.response, state); case REGISTER_FAILURE: return fullPageErrorState('register', action.error, state); case SIGNIN_REQUEST: return requestState('signin', {}, state); case SIGNIN_SUCCESS: return completionState('signin', getInitialState(), state); case SIGNIN_FAILURE: return fullPageErrorState('signin', action.error, state); case SIGNIN2_REQUEST: return requestState('signin2', {}, state); case SIGNIN2_SUCCESS: return completionState('signin2', action.response, state); case SIGNIN2_FAILURE: return fullPageErrorState('signin2', action.error, state); case DESTROY_SESSION: return { ...getInitialState(), error: state.error }; case REGISTER2_REQUEST: { const updatedStateProps = { register: {} }; return requestState('register2', updatedStateProps, state); } case REGISTER2_SUCESSS: { const updatedStateProps = { ...action.response, error: { ...state.error, inline: undefined } }; return completionState('register2', updatedStateProps, state); } case REGISTER2_FAILURE: { const { cardError, error } = action; const updatedStateProps = { error: { inline: cardError, fullPage: state.error.fullPage || error } }; return completionState('register2', updatedStateProps, state); } case SESSION_REQUEST: return requestState('session', {}, state); case SESSION_SUCCESS: return completionState('session', action.response, state); case SESSION_RESET: return { ...getInitialState(), error: state.error }; case SESSION_FAILURE: return fullPageErrorState('session', action.error, state); case UPDATE_STOCK_COUNT_REQUEST: return requestState('update-stock-count', {}, state); case UPDATE_STOCK_COUNT_SUCCESS: { const updatedItem = action.response; const { items } = state.store || []; const updatedState = { store: { ...state.store, items: [ ...items.filter(({ id }) => id !== updatedItem.id), updatedItem ] } }; return completionState('update-stock-count', updatedState, state); } case UPDATE_STOCK_COUNT_FAILURE: return fullPageErrorState('update-stock-count', action.error, state); case SUPPORT_REQUEST: return requestState('support', {}, state); case SUPPORT_SUCCESS: return completionState('support', {}, state); case SUPPORT_FAILURE: return fullPageErrorState('support', action.error, state); case LOGOUT_REQUEST: return requestState('logout', {}, state); case LOGOUT_SUCCESS: return completionState('logout', getInitialState(), state); case LOGOUT_FAILURE: return fullPageErrorState('logout', action.error, state); case TOPUP_REQUEST: return requestState('topup', {}, state); case TOPUP_SUCCESS: { const { balance, transaction, cardDetails } = action.response; const { user } = state; const updatedStateProps = { user: { ...state.user, balance, cardDetails, transactions: transaction != null ? [transaction, ...user.transactions] : user.transactions } }; return completionState('topup', updatedStateProps, state); } case TOPUP_FAILURE: { const { error, cardError } = action; const updatedStateProps = { error: { inline: cardError, fullPage: state.error.fullPage || error } }; return completionState('topup', updatedStateProps, state); } case PURCHASE_REQUEST: return requestState('purchase', {}, state); case PURCHASE_SUCCESS: { const { balance, transaction } = action.response; const { user } = state; const updatedStateProps = { user: { ...user, balance, transactions: [transaction, ...user.transactions] } }; return completionState('purchase', updatedStateProps, state); } case PURCHASE_FAILURE: return fullPageErrorState('purchase', action.error, state); case STORE_REQUEST: return requestState('store', {}, state); case STORE_SUCCESS: return completionState('store', action.response, state); case STORE_FAILURE: return fullPageErrorState('store', action.error, state); case MARKETPLACE_REQUEST: return requestState('marketplace', {}, state); case MARKETPLACE_SUCCESS: return completionState('marketplace', {}, state); case MARKETPLACE_FAILURE: return fullPageErrorState('marketplace', action.error, state); case LIKE_ITEM: { const { itemId } = action; const { likedItemIds } = state; const updatedItemIds = [...new Set(likedItemIds.concat(itemId))]; return { ...state, likedItemIds: updatedItemIds }; } case UNLIKE_ITEM: { const { itemId } = action; const { likedItemIds } = state; const updatedLikedItemIds = [...new Set(likedItemIds)].filter( el => el !== itemId ); return { ...state, likedItemIds: updatedLikedItemIds }; } case LOCAL_STORAGE_SAVE_ERROR: return { ...state, error: { fullPage: action.error } }; case REFUND_REQUEST: return requestState('refund', {}, state); case REFUND_SUCCESS: { const { balance, transaction } = action.response; const { user } = state; const updatedStateProps = { user: { ...user, balance, transactions: [transaction, ...user.transactions] } }; return completionState('refund', updatedStateProps, state); } case REFUND_FAILURE: return fullPageErrorState('refund', action.error, state); case LOGGED_OUT_IN_ANOTHER_SESSION: { const updatedState = { ...getInitialState(), error: { ...state.error, fullPage: state.error.fullPage } }; return fullPageErrorState(null, action.error, updatedState); } case ALL_ITEMS_REQUEST: return requestState('all-items', {}, state); case ALL_ITEMS_SUCCESS: { const { response } = action; const updatedStateProps = { admin: { ...state.admin, items: response } }; return completionState('all-items', updatedStateProps, state); } case ALL_ITEMS_FAILURE: return fullPageErrorState('all-items', action.error, state); case UPDATE_ITEM_REQUEST: return requestState('update-item', {}, state); case UPDATE_ITEM_SUCCESS: { const updatedItem = action.response; const { items } = state.admin || []; const updatedState = { admin: { ...state.admin, items: [ ...items.filter(({ id }) => id !== updatedItem.id), updatedItem ] } }; return completionState('update-item', updatedState, state); } case UPDATE_ITEM_FAILURE: return fullPageErrorState('update-item', action.error, state); case CREATE_ITEM_REQUEST: return requestState('create-item', {}, state); case CREATE_ITEM_SUCCESS: { const updatedItem = action.response; const { items } = state.admin || []; const updatedState = { admin: { ...state.admin, items: [...items, updatedItem] } }; return completionState('create-item', updatedState, state); } case CREATE_ITEM_FAILURE: return fullPageErrorState('create-item', action.error, state); case ALL_LISTINGS_REQUEST: return requestState('all-listings', {}, state); case ALL_LISTINGS_SUCCESS: { const { response: { items, revenue } } = action; const updatedState = { admin: { ...state.admin, store: { items, revenue } } }; return completionState('all-listings', updatedState, state); } case ALL_LISTINGS_FAILURE: return fullPageErrorState('all-listings', action.error, state); case UPDATE_LISTING_COUNT_REQUEST: return requestState('update-listing-count', {}, state); case UPDATE_LISTING_COUNT_SUCCESS: { const updatedListing = action.response; const { admin } = state; const updatedState = { admin: { ...admin, store: { ...admin.store, items: [ ...admin.store.items.filter(({ id }) => id !== updatedListing.id), updatedListing ] } } }; return completionState('update-listing-count', updatedState, state); } case UPDATE_LISTING_COUNT_FAILURE: return fullPageErrorState('update-listing-count', action.error, state); case UPDATE_LISTING_DETAILS_REQUEST: return requestState('update-listing-details', {}, state); case UPDATE_LISTING_DETAILS_SUCCESS: { const updatedListing = action.response; const { admin } = state; const updatedState = { admin: { ...admin, store: { ...admin.store, items: [ ...admin.store.items.filter(({ id }) => id !== updatedListing.id), updatedListing ] } } }; return completionState('update-listing-details', updatedState, state); } case UPDATE_LISTING_DETAILS_FAILURE: return fullPageErrorState('update-listing-details', action.error, state); case CREATE_LISTING_REQUEST: return requestState('create-listing', {}, state); case CREATE_LISTING_SUCCESS: { const { admin } = state; const updatedState = { admin: { ...admin, store: { ...admin.store, items: [...admin.store.items, action.response] } } }; return completionState('create-listing', updatedState, state); } case CREATE_LISTING_FAILURE: return fullPageErrorState('create-listing', action.error, state); case REMOVE_LISTING_REQUEST: return requestState('remove-listing', {}, state); case REMOVE_LISTING_SUCCESS: { const { admin } = state; const updatedState = { admin: { ...admin, store: { ...admin.store, items: [ ...admin.store.items.filter(({ id }) => id !== action.itemId) ] } } }; return completionState('remove-listing', updatedState, state); } case REMOVE_LISTING_FAILURE: return fullPageErrorState('remove-listing', action.error, state); case RELIST_REQUEST: return requestState('relist', {}, state); case RELIST_SUCCESS: { const { admin } = state; const relistedItem = action.response; const updatedState = { admin: { ...admin, store: { ...admin.store, items: [ ...admin.store.items.filter(({ id }) => id !== relistedItem.id), relistedItem ] } } }; return completionState('relist', updatedState, state); } case RELIST_FAILURE: return fullPageErrorState('relist', action.error, state); default: return state; } };
<gh_stars>0 import React, { MouseEventHandler } from 'react'; import DisplayBarLoading from './DisplayBarLoading'; import s from './index.scss'; interface Props { content?: string; right?: string; loading?: boolean; onClick?: MouseEventHandler<HTMLDivElement>; } const DisplayBar: React.FC<Props> = ({ content = '', right = '', loading, onClick }) => { return ( <div className={s.displayBar} onClick={onClick}> {loading ? ( <DisplayBarLoading /> ) : ( <> <div className={s.content}>{content}</div> <div className={s.rightContent}> <div className={s.rightBar}>{right}</div> </div> </> )} </div> ); }; export default DisplayBar;
module.exports = function (sequelize, DataTypes) { const Menu = sequelize.define( "Menu", { id: { type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true, }, category: { type: DataTypes.STRING, allowNull: false, }, createdAt: { type: DataTypes.DATE, defaultValue: DataTypes.DATE.NOW, }, updatedAt: { type: DataTypes.DATE, defaultValue: DataTypes.DATE.NOW, }, }, { freezeTableName: true, } ); Menu.associate = function (models) { Menu.hasMany(models.Appetizer, { // foreignKey: "MenuId", }); Menu.hasMany(models.Entree, { //foreignKey: "MenuId", }); Menu.hasMany(models.Dessert, { // foreignKey: "MenuId", }); Menu.hasMany(models.Drink, { // foreignKey: "MenuId", }); }; return Menu; };
<filename>app/containers/AddTodo/constants.js<gh_stars>0 /* * * AddTodo constants * */ export const ADD_TODO = 'app/AddTodo/ADD_TODO'; export const TOGGLE_TODO = 'app/AddTodo/TOGGLE_TODO';
#include <stdio.h> int main (void) { int choix; system("cat antibug.txt"); printf("Quel est votre choix ?"); scanf("%d", &choix); if(choix == 1) { system("cp /home/raph/fishgood/1/config.fish /home/raph/.config/fish/"); } if(choix == 2) { system("cp /home/raph/fishgood/2/config.fish /home/raph/.config/fish/"); } return 0; }
# switch to the version cd googletest git checkout v1.8.x cd .. mkdir -p build cd build cmake ../googletest make
const CommandStructures = require('./structures/command/') module.exports = { // Command Structures CommandStructures, Command: CommandStructures.Command, CommandContext: CommandStructures.CommandContext, CommandError: CommandStructures.CommandError, CommandParameter: CommandStructures.CommandParameter, CommandRequirements: CommandStructures.CommandRequirements, Parameter: CommandStructures.Parameter, // Loaders CommandLoader: require('./loaders/CommandLoader.js'), ListenerLoader: require("./loaders/ListenerLoader.js"), LocaleLoader: require("./loaders/LocaleLoader.js"), ControllerLoader: require("./loaders/ControllerLoader.js"), // Utils Constants: require("./utils/Constants.js"), Permissions: require("./utils/Permissions.js"), DatabaseCheck: require("./utils/DatabaseCheck.js"), FileUtils: require("./utils/FileUtils.js"), // Structures EventHandler: require("./structures/EventHandler.js"), MayfiEmbed: require('./structures/MayfiEmbed.js'), Controller: require("./structures/Controller.js") }
class Point { x: number; y: number; //constructor constructor(x: number, y: number) { this.x = x; this.y = y; } //methods getDistance(p2: Point): number { const dx = this.x - p2.x; const dy = this.y - p2.y; return Math.sqrt(dx*dx + dy*dy); } toString(): string { return `Point x:${this.x}, y:${this.y}` } }
#!/bin/bash # Copyright 2014 The Kubernetes Authors All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # TODO(jbeda): Provide a way to override project # gcloud multiplexing for shared GCE/GKE tests. GCLOUD=gcloud ZONE=${KUBE_GCE_ZONE:-us-central1-b} MASTER_SIZE=${MASTER_SIZE:-n1-standard-2} NODE_SIZE=${NODE_SIZE:-n1-standard-2} NUM_NODES=${NUM_NODES:-3} MASTER_DISK_TYPE=pd-ssd MASTER_DISK_SIZE=${MASTER_DISK_SIZE:-20GB} NODE_DISK_TYPE=${NODE_DISK_TYPE:-pd-standard} NODE_DISK_SIZE=${NODE_DISK_SIZE:-100GB} REGISTER_MASTER_KUBELET=${REGISTER_MASTER:-false} KUBE_APISERVER_REQUEST_TIMEOUT=300 PREEMPTIBLE_NODE=${PREEMPTIBLE_NODE:-false} OS_DISTRIBUTION=${KUBE_OS_DISTRIBUTION:-debian} MASTER_IMAGE=${KUBE_GCE_MASTER_IMAGE:-container-vm-v20160127} MASTER_IMAGE_PROJECT=${KUBE_GCE_MASTER_PROJECT:-google-containers} NODE_IMAGE=${KUBE_GCE_NODE_IMAGE:-"${MASTER_IMAGE}"} NODE_IMAGE_PROJECT=${KUBE_GCE_NODE_PROJECT:-"${MASTER_IMAGE_PROJECT}"} CONTAINER_RUNTIME=${KUBE_CONTAINER_RUNTIME:-docker} RKT_VERSION=${KUBE_RKT_VERSION:-0.5.5} NETWORK=${KUBE_GCE_NETWORK:-e2e} INSTANCE_PREFIX="${KUBE_GCE_INSTANCE_PREFIX:-e2e-test-${USER}}" MASTER_NAME="${INSTANCE_PREFIX}-master" MASTER_TAG="${INSTANCE_PREFIX}-master" NODE_TAG="${INSTANCE_PREFIX}-minion" CLUSTER_IP_RANGE="${CLUSTER_IP_RANGE:-10.245.0.0/16}" MASTER_IP_RANGE="${MASTER_IP_RANGE:-10.246.0.0/24}" NODE_SCOPES="${NODE_SCOPES:-compute-rw,monitoring,logging-write,storage-ro}" RUNTIME_CONFIG="${KUBE_RUNTIME_CONFIG:-}" TERMINATED_POD_GC_THRESHOLD=${TERMINATED_POD_GC_THRESHOLD:-100} # Optional: enable v1beta1 related features ENABLE_DEPLOYMENTS="${KUBE_ENABLE_DEPLOYMENTS:-true}" ENABLE_DAEMONSETS="${KUBE_ENABLE_DAEMONSETS:-true}" ENABLE_REPLICASETS="${KUBE_ENABLE_REPLICASETS:-true}" # Increase the sleep interval value if concerned about API rate limits. 3, in seconds, is the default. POLL_SLEEP_INTERVAL=3 SERVICE_CLUSTER_IP_RANGE="10.0.0.0/16" # formerly PORTAL_NET # Optional: Deploy a L7 loadbalancer controller to fulfill Ingress requests: # glbc - CE L7 Load Balancer Controller ENABLE_L7_LOADBALANCING="${KUBE_ENABLE_L7_LOADBALANCING:-glbc}" # Optional: Cluster monitoring to setup as part of the cluster bring up: # none - No cluster monitoring setup # influxdb - Heapster, InfluxDB, and Grafana # google - Heapster, Google Cloud Monitoring, and Google Cloud Logging # googleinfluxdb - Enable influxdb and google (except GCM) # standalone - Heapster only. Metrics available via Heapster REST API. ENABLE_CLUSTER_MONITORING="${KUBE_ENABLE_CLUSTER_MONITORING:-influxdb}" # Default Log level for all components in test clusters and variables to override it in specific components. TEST_CLUSTER_LOG_LEVEL="${TEST_CLUSTER_LOG_LEVEL:---v=4}" KUBELET_TEST_LOG_LEVEL="${KUBELET_TEST_LOG_LEVEL:-$TEST_CLUSTER_LOG_LEVEL}" API_SERVER_TEST_LOG_LEVEL="${API_SERVER_TEST_LOG_LEVEL:-$TEST_CLUSTER_LOG_LEVEL}" CONTROLLER_MANAGER_TEST_LOG_LEVEL="${CONTROLLER_MANAGER_TEST_LOG_LEVEL:-$TEST_CLUSTER_LOG_LEVEL}" SCHEDULER_TEST_LOG_LEVEL="${SCHEDULER_TEST_LOG_LEVEL:-$TEST_CLUSTER_LOG_LEVEL}" KUBEPROXY_TEST_LOG_LEVEL="${KUBEPROXY_TEST_LOG_LEVEL:-$TEST_CLUSTER_LOG_LEVEL}" TEST_CLUSTER_RESYNC_PERIOD="${TEST_CLUSTER_RESYNC_PERIOD:---min-resync-period=3m}" KUBELET_TEST_ARGS="--max-pods=110 --serialize-image-pulls=false --outofdisk-transition-frequency=0" APISERVER_TEST_ARGS="--runtime-config=extensions/v1beta1" CONTROLLER_MANAGER_TEST_ARGS="${TEST_CLUSTER_RESYNC_PERIOD}" SCHEDULER_TEST_ARGS="" KUBEPROXY_TEST_ARGS="" # Optional: Enable node logging. ENABLE_NODE_LOGGING="${KUBE_ENABLE_NODE_LOGGING:-true}" LOGGING_DESTINATION="${KUBE_LOGGING_DESTINATION:-elasticsearch}" # options: elasticsearch, gcp # Optional: When set to true, Elasticsearch and Kibana will be setup as part of the cluster bring up. ENABLE_CLUSTER_LOGGING="${KUBE_ENABLE_CLUSTER_LOGGING:-true}" ELASTICSEARCH_LOGGING_REPLICAS=1 # Optional: Don't require https for registries in our local RFC1918 network if [[ ${KUBE_ENABLE_INSECURE_REGISTRY:-false} == "true" ]]; then EXTRA_DOCKER_OPTS="--insecure-registry 10.0.0.0/8" fi # Optional: Install cluster DNS. ENABLE_CLUSTER_DNS="${KUBE_ENABLE_CLUSTER_DNS:-true}" DNS_SERVER_IP="10.0.0.10" DNS_DOMAIN="cluster.local" DNS_REPLICAS=1 # Optional: Install cluster docker registry. ENABLE_CLUSTER_REGISTRY="${KUBE_ENABLE_CLUSTER_REGISTRY:-false}" CLUSTER_REGISTRY_DISK="${CLUSTER_REGISTRY_DISK:-${INSTANCE_PREFIX}-kube-system-kube-registry}" CLUSTER_REGISTRY_DISK_SIZE="${CLUSTER_REGISTRY_DISK_SIZE:-200GB}" CLUSTER_REGISTRY_DISK_TYPE_GCE="${CLUSTER_REGISTRY_DISK_TYPE_GCE:-pd-standard}" # Optional: Install Kubernetes UI ENABLE_CLUSTER_UI="${KUBE_ENABLE_CLUSTER_UI:-true}" # Optional: Create autoscaler for cluster's nodes. ENABLE_NODE_AUTOSCALER="${KUBE_ENABLE_NODE_AUTOSCALER:-false}" if [[ "${ENABLE_NODE_AUTOSCALER}" == "true" ]]; then AUTOSCALER_MIN_NODES="${KUBE_AUTOSCALER_MIN_NODES:-1}" AUTOSCALER_MAX_NODES="${KUBE_AUTOSCALER_MAX_NODES:-${NUM_NODES}}" TARGET_NODE_UTILIZATION="${KUBE_TARGET_NODE_UTILIZATION:-0.7}" fi ADMISSION_CONTROL="${KUBE_ADMISSION_CONTROL:-NamespaceLifecycle,LimitRanger,SecurityContextDeny,ServiceAccount,ResourceQuota,PersistentVolumeLabel}" # Optional: if set to true kube-up will automatically check for existing resources and clean them up. KUBE_UP_AUTOMATIC_CLEANUP=${KUBE_UP_AUTOMATIC_CLEANUP:-false} # Optional: setting it to true denotes this is a testing cluster, # so that we can use pulled kubernetes binaries, even if binaries # are pre-installed in the image. Note that currently this logic # is only supported in trusty nodes. TEST_CLUSTER="${TEST_CLUSTER:-true}" # OpenContrail networking plugin specific settings NETWORK_PROVIDER="${NETWORK_PROVIDER:-none}" # opencontrail,flannel OPENCONTRAIL_TAG="${OPENCONTRAIL_TAG:-R2.20}" OPENCONTRAIL_KUBERNETES_TAG="${OPENCONTRAIL_KUBERNETES_TAG:-master}" OPENCONTRAIL_PUBLIC_SUBNET="${OPENCONTRAIL_PUBLIC_SUBNET:-10.1.0.0/16}" # Optional: if set to true, kube-up will configure the cluster to run e2e tests. E2E_STORAGE_TEST_ENVIRONMENT=${KUBE_E2E_STORAGE_TEST_ENVIRONMENT:-false}
package com.example.doubanmovie.main; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import com.example.doubanmovie.R; /** * A simple {@link Fragment} subclass. * Activities that contain this fragment must implement the * {@link TextFragment.OnFragmentInteractionListener} interface * to handle interaction events. * Use the {@link TextFragment#newInstance} factory method to * create an instance of this fragment. */ public class TextFragment extends Fragment { // TODO: Rename parameter arguments, choose names that match // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER private static final String ARG_PARAM1 = "param1"; private static final String ARG_PARAM2 = "param2"; // TODO: Rename and change types of parameters public TextFragment() { // Required empty public constructor } public static TextFragment textFragment() { TextFragment fragment = new TextFragment(); return fragment; } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fg_movie_two, container, false); TextView textView = view.findViewById(R.id.pagetwo); textView.setText("你点到第二页了!"); return view; } }
<reponame>SaveYourTime/childrens-literature<gh_stars>0 (function ($) { $(function () { M.AutoInit(); $('.sidenav') .sidenav() .on('click tap', 'li a', () => { $('.sidenav').sidenav('close'); }); M.Collapsible.init($('.collapsible.expandable'), { accordion: false }); $('.slider').slider({ indicators: false, height: 300, duration: 500, interval: 2000, }); document.querySelector('.read-more a').addEventListener('click', (e) => { document.querySelector('.read-more').style.display = 'none'; document.querySelector('.table-wrapper').style.maxHeight = `${document.querySelector('.table-wrapper').scrollHeight}px`; }); window.addEventListener('scroll', () => { const nav = document.querySelector('nav'); nav.classList.toggle('hide-box-shadow', !window.pageYOffset); window.innerWidth > 992 && nav.style.setProperty('background-color', `rgba(255, 255, 255, ${window.pageYOffset / 300})`, 'important'); }); }); })(jQuery);
import code import collections import logging import sys try: import matplotlib.pyplot as plt except ImportError: plt = None import numpy import rasterio logger = logging.getLogger('rasterio') Stats = collections.namedtuple('Stats', ['min', 'max', 'mean']) # Collect dictionary of functions for use in the interpreter in main() funcs = locals() def show(source, cmap='gray'): """Show a raster using matplotlib. The raster may be either an ndarray or a (dataset, bidx) tuple. """ if isinstance(source, tuple): arr = source[0].read_band(source[1]) else: arr = source if plt is not None: plt.imshow(arr, cmap=cmap) plt.show() else: raise ImportError("matplotlib could not be imported") def stats(source): """Return a tuple with raster min, max, and mean. """ if isinstance(source, tuple): arr = source[0].read_band(source[1]) else: arr = source return Stats(numpy.min(arr), numpy.max(arr), numpy.mean(arr)) def main(banner, dataset): """ Main entry point for use with interpreter """ code.interact( banner, local=dict(funcs, src=dataset, np=numpy, rio=rasterio, plt=plt)) return 0
#!/bin/bash #convert mp4 to ts function batch_convert() { for file in `ls $1` do if [ -d $1"/"$file ] then batch_convert $1"/"$file elif [ "${file##*.}" = "mp4" -o "${file##*.}" = "MP4" ] then #replace old path, remove suffix file2folder=$TS_VIDEO_DIR${1/$MP4_VIDEO_DIR/}"/"${file%.*} if [ ! -d $file2folder ] then mkdir -p $file2folder fi #echo $1" : "$1"/"$file ffmpeg -i $1"/"$file -f segment -segment_time $VIDEO_SEGMENT_TIME -segment_format mpegts -segment_list $file2folder"/playlist.m3u8" -c copy -bsf:v h264_mp4toannexb -map 0 $file2folder"/%03d.ts" cp /root/player.html $file2folder"/index.html" echo $file" convert success!" fi done } batch_convert $MP4_VIDEO_DIR # upload to ftp server lftp -u $FTP_USER,$FTP_PASSWORD -e "set ftp:ssl-allow no; mirror -R --only-newer --only-missing --verbose --parallel=$FTP_UPLOAD_PARALLEL $TS_VIDEO_DIR/ $FTP_UPLOAD_DIR;exit;" $FTP_SERVER
#include <stdio.h> #include <stdlib.h> #include <string.h> char* modifyHTTPDate(const char* httpdate) { char* modifiedDate = (char*)malloc(strlen(httpdate) * 2); // Allocate memory for the modified string const char* ptr1 = httpdate; char* ptr2 = modifiedDate; do { if (*ptr1 == ' ') { *ptr2++ = ';'; // Replace space with semicolon } else { *ptr2++ = *ptr1; // Copy the character as is } } while (*ptr1++ != '\0'); *ptr2 = '\0'; // Add null terminator to the modified string return modifiedDate; } int main() { const char* httpdate = "Sun, 06 Nov 1994 08:49:37 GMT"; char* modifiedDate = modifyHTTPDate(httpdate); printf("Modified HTTP Date: %s\n", modifiedDate); free(modifiedDate); // Free the allocated memory return 0; }
<filename>CarteService/default/src/main/java/org/rzo/yajsw/wrapper/AbstractWrappedProcessMBean.java package org.rzo.yajsw.wrapper; import java.awt.Color; import java.util.Date; public interface AbstractWrappedProcessMBean { /** * Start. */ public void start(); /** * Stop. */ public void stop(); public void stop(String reason); /** * Restart. */ public void restart(); /** * Gets the pid. * * @return the pid */ public int getAppPid(); /** * Gets the exit code. * * @return the exit code */ public int getExitCode(); public String getStringState(); public void threadDump(); public void gc(); public void wrapperThreadDump(); public String getType(); public String getName(); public void waitFor(); public void stopTimerCondition(); public boolean isTimerActive(); public boolean isConditionActive(); public int getTotalRestartCount(); public int getRestartCount(); public Date getAppStarted(); public Date getAppStopped(); public int getWrapperPid(); public Date getWrapperStarted(); public int getAppCpu(); public int getAppHandles(); public long getAppVMemory(); public long getAppPMemory(); public int getAppThreads(); public void startDrain(); public String readDrainLine(); public void stopDrain(); public int getState(); public String[][] getTrayIconMessages(); public void stopWrapper(); public boolean hasOutput(); public void writeOutput(String txt); public void writeInquireResponse(String s); public String getInquireMessage(); public void init(); public void setProperty(String key, String value); public void resetCache(); public boolean isAppReportedReady(); public void dumpHeap(String s); public Color getUserTrayColor(); public void update(String updateConfFile); }
<reponame>Riszin-LLC/winget-cli // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. #include "pch.h" #include "Public/AppInstallerFileLogger.h" #include "Public/AppInstallerRuntime.h" #include "Public/AppInstallerDateTime.h" #define AICLI_FILELOGGER_DEFAULT_FILE_PREFIX "WinGet-" #define AICLI_FILELOGGER_DEFAULT_FILE_EXT ".log" namespace AppInstaller::Logging { FileLogger::FileLogger(const std::filesystem::path& filePath) { if (filePath.empty()) { m_name = "file"; m_filePath = Runtime::GetPathToDefaultLogLocation(); m_filePath /= AICLI_FILELOGGER_DEFAULT_FILE_PREFIX + Utility::GetCurrentTimeForFilename() + AICLI_FILELOGGER_DEFAULT_FILE_EXT; } else { m_name = GetNameForPath(filePath); m_filePath = filePath; } m_stream.open(m_filePath); } FileLogger::~FileLogger() { m_stream.flush(); } std::string FileLogger::GetNameForPath(const std::filesystem::path& filePath) { using namespace std::string_literals; return "file :: "s + filePath.u8string(); } std::string FileLogger::GetName() const { return m_name; } void FileLogger::Write(Channel channel, Level, std::string_view message) noexcept try { // Send to a string first to create a single block to write to a file. std::stringstream strstr; strstr << std::chrono::system_clock::now() << " [" << std::setw(GetMaxChannelNameLength()) << std::left << std::setfill(' ') << GetChannelName(channel) << "] " << message; m_stream << strstr.str() << std::endl; } catch (...) { // Just eat any exceptions here; better than losing logs } }
class Node: def __init__(self, data): self.data = data self.next = None def find_fifth_from_end(self): if self is None: return None curr = self prev = self count = 0 while curr.next is not None: count += 1 if count >= 5: prev = prev.next curr = curr.next if count < 5: return None else: return prev.data # Example n1 = Node(1) n2 = Node(2) n3 = Node(3) n4 = Node(4) n5 = Node(5) n6 = Node(6) n7 = Node(7) # Linked list setup n1.next = n2 n2.next = n3 n3.next = n4 n4.next = n5 n5.next = n6 n6.next = n7 # Find 4th element from the end print(n1.find_fifth_from_end())
<reponame>stephenjelfs/react-dnd-tutorial-typescript-mobx import * as React from "react"; import {DragSource, DragSourceSpec, ConnectDragSource, DragSourceCollector} from "react-dnd"; import {ItemTypes} from "../Constants"; const knightSource: DragSourceSpec<KnightProps> = { beginDrag(props) { return {}; } }; const collect: DragSourceCollector = (connect, monitor) => { return { connectDragSource: connect.dragSource(), isDragging: monitor.isDragging() } }; export interface KnightProps { connectDragSource?: ConnectDragSource; isDragging?: boolean; } @DragSource(ItemTypes.KNIGHT, knightSource, collect) export class Knight extends React.Component<KnightProps, undefined> { render() { const { connectDragSource, isDragging } = this.props; return connectDragSource( <div style={{ opacity: isDragging ? 0.5 : 1, fontSize: 25, fontWeight: 'bold', cursor: 'move' }}> ♘ </div> ); } }
/* * Tencent is pleased to support the open source community by making 蓝鲸 available. * Copyright (C) 2017-2018 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT * Unless required by applicable law or agreed to in writing, software distributed under * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, * either express or implied. See the License for the specific language governing permissions and * limitations under the License. */ package v3v0v8 import ( "time" "configcenter/src/common" "configcenter/src/common/metadata" mCommon "configcenter/src/scene_server/admin_server/common" ) // default group var ( groupBaseInfo = mCommon.BaseInfo ) // Distribution init revision var Distribution = "community" // could be community or enterprise /* &Attribute{ObjectID: objID, PropertyID: "", PropertyName: "", IsRequired: , IsOnly: , PropertyGroup: , PropertyType: , Option: ""}, */ // AppRow app structure func AppRow() []*Attribute { objID := common.BKInnerObjIDApp groupAppRole := mCommon.AppRole lifeCycleOption := []metadata.EnumVal{{ID: "1", Name: "测试中", Type: "text"}, {ID: "2", Name: "已上线", Type: "text", IsDefault: true}, {ID: "3", Name: "停运", Type: "text"}} languageOption := []metadata.EnumVal{{ID: "1", Name: "中文", Type: "text", IsDefault: true}, {ID: "2", Name: "English", Type: "text"}} dataRows := []*Attribute{ &Attribute{ObjectID: objID, PropertyID: "bk_biz_name", PropertyName: "业务名", IsRequired: true, IsOnly: true, IsEditable: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeSingleChar, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "life_cycle", PropertyName: "生命周期", IsRequired: false, IsOnly: false, IsEditable: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeEnum, Option: lifeCycleOption}, //role &Attribute{ObjectID: objID, PropertyID: common.BKMaintainersField, PropertyName: "运维人员", IsRequired: true, IsOnly: false, IsEditable: true, PropertyGroup: groupAppRole, PropertyType: common.FieldTypeUser, Option: ""}, &Attribute{ObjectID: objID, PropertyID: common.BKProductPMField, PropertyName: "产品人员", IsRequired: false, IsOnly: false, IsEditable: true, PropertyGroup: groupAppRole, PropertyType: common.FieldTypeUser, Option: ""}, &Attribute{ObjectID: objID, PropertyID: common.BKTesterField, PropertyName: "测试人员", IsRequired: false, IsOnly: false, IsEditable: true, PropertyGroup: groupAppRole, PropertyType: common.FieldTypeUser, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "bk_biz_developer", PropertyName: "开发人员", IsRequired: false, IsOnly: false, IsEditable: true, PropertyGroup: groupAppRole, PropertyType: common.FieldTypeUser, Option: ""}, &Attribute{ObjectID: objID, PropertyID: common.BKOperatorField, PropertyName: "操作人员", IsRequired: false, IsOnly: false, IsEditable: true, PropertyGroup: groupAppRole, PropertyType: common.FieldTypeUser, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "time_zone", PropertyName: "时区", IsRequired: true, IsOnly: false, IsEditable: false, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeTimeZone, Option: "", IsReadOnly: true}, &Attribute{ObjectID: objID, PropertyID: "language", PropertyName: "语言", IsRequired: true, IsOnly: false, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeEnum, Option: languageOption, IsReadOnly: true}, } return dataRows } // SetRow set structure func SetRow() []*Attribute { objID := common.BKInnerObjIDSet serviceStatusOption := []metadata.EnumVal{{ID: "1", Name: "开放", Type: "text", IsDefault: true}, {ID: "2", Name: "关闭", Type: "text"}} dataRows := []*Attribute{ &Attribute{ObjectID: objID, PropertyID: common.BKAppIDField, PropertyName: "业务ID", IsAPI: true, IsRequired: false, IsOnly: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeInt, Option: metadata.IntOption{}}, &Attribute{ObjectID: objID, PropertyID: "bk_set_name", PropertyName: "集群名字", IsRequired: true, IsOnly: true, IsEditable: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeSingleChar, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "bk_set_desc", PropertyName: "集群描述", IsRequired: false, IsOnly: false, IsEditable: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeSingleChar, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "bk_set_env", PropertyName: "环境类型", IsRequired: false, IsOnly: false, IsEditable: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeEnum, Option: []metadata.EnumVal{{ID: "1", Name: "测试", Type: "text"}, {ID: "2", Name: "体验", Type: "text"}, {ID: "3", Name: "正式", Type: "text", IsDefault: true}}}, &Attribute{ObjectID: objID, PropertyID: "bk_service_status", PropertyName: "服务状态", IsRequired: false, IsOnly: false, IsEditable: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeEnum, Option: serviceStatusOption}, &Attribute{ObjectID: objID, PropertyID: "description", PropertyName: "备注", IsRequired: false, IsOnly: false, IsEditable: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeLongChar, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "bk_capacity", PropertyName: "设计容量", IsRequired: false, IsOnly: false, IsEditable: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeInt, Option: metadata.IntOption{Min: "1", Max: "999999999"}}, &Attribute{ObjectID: objID, PropertyID: common.BKChildStr, PropertyName: "", IsRequired: false, IsOnly: false, IsSystem: true, PropertyType: "", Option: ""}, &Attribute{ObjectID: objID, PropertyID: common.BKInstParentStr, PropertyName: "", IsSystem: true, IsRequired: true, IsOnly: true, PropertyType: common.FieldTypeInt, Option: metadata.IntOption{}}, } return dataRows } // ModuleRow module structure func ModuleRow() []*Attribute { objID := common.BKInnerObjIDModule moduleTypeOption := []metadata.EnumVal{{ID: "1", Name: "普通", Type: "text", IsDefault: true}, {ID: "2", Name: "数据库", Type: "text"}} dataRows := []*Attribute{ &Attribute{ObjectID: objID, PropertyID: common.BKAppIDField, PropertyName: "业务ID", IsAPI: true, IsRequired: false, IsOnly: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeInt, Option: metadata.IntOption{}}, &Attribute{ObjectID: objID, PropertyID: common.BKSetIDField, PropertyName: "集群ID", IsAPI: true, IsRequired: false, IsOnly: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeInt, Option: metadata.IntOption{}}, &Attribute{ObjectID: objID, PropertyID: common.BKModuleNameField, PropertyName: "模块名", IsRequired: true, IsOnly: true, IsEditable: true, PropertyType: common.FieldTypeSingleChar, Option: ""}, &Attribute{ObjectID: objID, PropertyID: common.BKChildStr, PropertyName: "", IsRequired: false, IsOnly: false, IsSystem: true, PropertyType: "", Option: ""}, &Attribute{ObjectID: objID, PropertyID: "bk_module_type", PropertyName: "模块类型", IsRequired: false, IsOnly: false, IsEditable: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeEnum, Option: moduleTypeOption}, &Attribute{ObjectID: objID, PropertyID: "operator", PropertyName: "主要维护人", IsRequired: false, IsOnly: false, IsEditable: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeUser, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "bk_bak_operator", PropertyName: "备份维护人", IsRequired: false, IsOnly: false, IsEditable: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeUser, Option: ""}, } return dataRows } // PlatRow plat structure func PlatRow() []*Attribute { objID := common.BKInnerObjIDPlat dataRows := []*Attribute{ &Attribute{ObjectID: objID, PropertyID: common.BKCloudNameField, PropertyName: "云区域", IsRequired: true, IsOnly: true, IsPre: true, IsEditable: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeSingleChar, Option: ""}, &Attribute{ObjectID: objID, PropertyID: common.BKOwnerIDField, PropertyName: "供应商", IsRequired: true, IsOnly: true, IsPre: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeSingleChar, Option: ""}, } return dataRows } // HostRow host structure func HostRow() []*Attribute { objID := common.BKInnerObjIDHost groupAgent := mCommon.HostAutoFields dataRows := []*Attribute{ //基本信息分组 &Attribute{ObjectID: objID, PropertyID: common.BKHostInnerIPField, PropertyName: "内网IP", IsRequired: true, IsOnly: true, IsEditable: false, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeSingleChar, Option: common.PatternMultipleIP}, &Attribute{ObjectID: objID, PropertyID: common.BKHostOuterIPField, PropertyName: "外网IP", IsRequired: false, IsOnly: false, IsEditable: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeSingleChar, Option: common.PatternMultipleIP}, &Attribute{ObjectID: objID, PropertyID: "operator", PropertyName: "主要维护人", IsRequired: false, IsOnly: false, IsEditable: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeUser, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "bk_bak_operator", PropertyName: "备份维护人", IsRequired: false, IsOnly: false, IsEditable: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeUser, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "bk_asset_id", PropertyName: "固资编号", IsRequired: false, IsOnly: false, IsEditable: false, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeSingleChar, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "bk_sn", PropertyName: "设备SN", IsRequired: false, IsOnly: false, IsEditable: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeSingleChar, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "bk_comment", PropertyName: "备注", IsRequired: false, IsOnly: false, IsEditable: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeLongChar, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "bk_service_term", PropertyName: "质保年限", IsRequired: false, IsOnly: false, IsEditable: false, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeInt, Option: metadata.IntOption{Min: "1", Max: "10"}}, &Attribute{ObjectID: objID, PropertyID: "bk_sla", PropertyName: "SLA级别", IsRequired: false, IsOnly: false, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeEnum, Option: []metadata.EnumVal{{ID: "1", Name: "L1", Type: "text"}, {ID: "2", Name: "L2", Type: "text"}, {ID: "3", Name: "L3", Type: "text"}}}, &Attribute{ObjectID: objID, PropertyID: common.BKCloudIDField, PropertyName: "云区域", IsRequired: false, IsOnly: true, IsEditable: false, PropertyGroup: groupBaseInfo, PropertyType: "singleasst", Option: ""}, &Attribute{ObjectID: objID, PropertyID: "bk_state_name", PropertyName: "所在国家", IsRequired: false, IsOnly: false, IsEditable: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeEnum, Option: stateEnum}, &Attribute{ObjectID: objID, PropertyID: "bk_province_name", PropertyName: "所在省份", IsRequired: false, IsOnly: false, IsEditable: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeEnum, Option: provincesEnum}, &Attribute{ObjectID: objID, PropertyID: "bk_isp_name", PropertyName: "所属运营商", IsRequired: false, IsOnly: false, IsEditable: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeEnum, Option: ispNameEnum}, //自动发现分组 &Attribute{ObjectID: objID, PropertyID: "bk_host_name", PropertyName: "主机名称", IsRequired: false, IsOnly: false, PropertyGroup: groupAgent, PropertyType: common.FieldTypeSingleChar, Option: ""}, &Attribute{ObjectID: objID, PropertyID: common.BKOSTypeField, PropertyName: "操作系统类型", IsRequired: false, IsOnly: false, PropertyGroup: groupAgent, PropertyType: common.FieldTypeEnum, Option: []metadata.EnumVal{{ID: "1", Name: "Linux", Type: "text"}, {ID: "2", Name: "Windows", Type: "text"}}}, &Attribute{ObjectID: objID, PropertyID: common.BKOSNameField, PropertyName: "操作系统名称", IsRequired: false, IsOnly: false, PropertyGroup: groupAgent, PropertyType: common.FieldTypeSingleChar, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "bk_os_version", PropertyName: "操作系统版本", IsRequired: false, IsOnly: false, PropertyGroup: groupAgent, PropertyType: common.FieldTypeSingleChar, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "bk_os_bit", PropertyName: "操作系统位数", IsRequired: false, IsOnly: false, PropertyGroup: groupAgent, PropertyType: common.FieldTypeSingleChar, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "bk_cpu", PropertyName: "CPU逻辑核心数", IsRequired: false, IsOnly: false, PropertyGroup: groupAgent, PropertyType: common.FieldTypeInt, Option: metadata.IntOption{Min: "1", Max: "1000000"}}, &Attribute{ObjectID: objID, PropertyID: "bk_cpu_mhz", PropertyName: "CPU频率", IsRequired: false, IsOnly: false, PropertyGroup: groupAgent, PropertyType: common.FieldTypeInt, Unit: "Hz", Option: metadata.IntOption{Min: "1", Max: "100000000"}}, &Attribute{ObjectID: objID, PropertyID: "bk_cpu_module", PropertyName: "CPU型号", IsRequired: false, IsOnly: false, PropertyGroup: groupAgent, PropertyType: common.FieldTypeSingleChar, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "bk_mem", PropertyName: "内存容量", IsRequired: false, IsOnly: false, PropertyGroup: groupAgent, PropertyType: common.FieldTypeInt, Unit: "MB", Option: metadata.IntOption{Min: "1", Max: "100000000"}}, &Attribute{ObjectID: objID, PropertyID: "bk_disk", PropertyName: "磁盘容量", IsRequired: false, IsOnly: false, PropertyGroup: groupAgent, PropertyType: common.FieldTypeInt, Unit: "GB", Option: metadata.IntOption{Min: "1", Max: "100000000"}}, &Attribute{ObjectID: objID, PropertyID: "bk_mac", PropertyName: "内网MAC地址", IsRequired: false, IsOnly: false, PropertyGroup: groupAgent, PropertyType: common.FieldTypeSingleChar, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "bk_outer_mac", PropertyName: "外网MAC", IsRequired: false, IsOnly: false, PropertyGroup: groupAgent, PropertyType: common.FieldTypeSingleChar, Option: ""}, //agent 没有分组 &Attribute{ObjectID: objID, PropertyID: common.CreateTimeField, PropertyName: "录入时间", IsRequired: false, IsOnly: false, IsEditable: false, PropertyGroup: mCommon.GroupNone, PropertyType: common.FieldTypeTime, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "import_from", PropertyName: "录入方式", IsRequired: false, IsOnly: false, IsEditable: false, PropertyGroup: mCommon.GroupNone, PropertyType: common.FieldTypeEnum, Option: []metadata.EnumVal{{ID: "1", Name: "excel", Type: "text"}, {ID: "2", Name: "agent", Type: "text"}, {ID: "3", Name: "api", Type: "text"}}}, } return dataRows } // ProcRow proc structure func ProcRow() []*Attribute { objID := common.BKInnerObjIDProc groupPort := mCommon.ProcPort // groupGsekit := mCommon.Proc_gsekit_base_info // groupGsekitManage := mCommon.Proc_gsekit_manage_info dataRows := []*Attribute{ //base info //&Attribute{ObjectID: objID, PropertyID: "bk_process_id", PropertyName: "进程ID", IsSystem: true, IsRequired: true, IsOnly: false, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeInt, Option: "{}"}, &Attribute{ObjectID: objID, PropertyID: common.BKAppIDField, PropertyName: "业务ID", IsAPI: true, IsRequired: true, IsOnly: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeInt, Option: metadata.IntOption{}}, &Attribute{ObjectID: objID, PropertyID: common.BKProcessNameField, PropertyName: "进程名称", IsRequired: true, IsOnly: true, IsPre: true, IsEditable: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeSingleChar, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "description", PropertyName: "进程描述", IsRequired: false, IsOnly: false, IsPre: true, IsEditable: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeSingleChar, Option: ""}, //监听端口分组 &Attribute{ObjectID: objID, PropertyID: "bind_ip", PropertyName: "绑定IP", IsRequired: false, IsOnly: false, IsEditable: true, PropertyGroup: groupPort, PropertyType: common.FieldTypeEnum, Option: []metadata.EnumVal{{ID: "1", Name: "127.0.0.1", Type: "text"}, {ID: "2", Name: "0.0.0.0", Type: "text"}, {ID: "3", Name: "第一内网IP", Type: "text"}, {ID: "4", Name: "第一外网IP", Type: "text"}}}, &Attribute{ObjectID: objID, PropertyID: "port", PropertyName: "端口", IsRequired: false, IsOnly: false, IsEditable: true, PropertyGroup: groupPort, PropertyType: common.FieldTypeSingleChar, Option: common.PatternMultiplePortRange, Placeholder: `单个端口:8080 </br>多个连续端口:8080-8089 </br>多个不连续端口:8080-8089,8199`}, &Attribute{ObjectID: objID, PropertyID: "protocol", PropertyName: "协议", IsRequired: false, IsOnly: false, IsEditable: true, PropertyGroup: groupPort, PropertyType: common.FieldTypeEnum, Option: []metadata.EnumVal{{ID: "1", Name: "TCP", Type: "text"}, {ID: "2", Name: "UDP", Type: "text"}}}, //gsekit 基础信息 &Attribute{ObjectID: objID, PropertyID: "bk_func_id", PropertyName: "功能ID", IsRequired: false, IsOnly: false, IsEditable: true, PropertyGroup: mCommon.GroupNone, PropertyType: common.FieldTypeSingleChar, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "bk_func_name", PropertyName: "功能名称", IsRequired: false, IsOnly: false, IsEditable: true, PropertyGroup: mCommon.GroupNone, PropertyType: common.FieldTypeSingleChar, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "work_path", PropertyName: "工作路径", IsRequired: false, IsOnly: false, IsEditable: true, PropertyGroup: mCommon.GroupNone, PropertyType: common.FieldTypeLongChar, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "user", PropertyName: "启动用户", IsRequired: false, IsOnly: false, IsEditable: true, PropertyGroup: mCommon.GroupNone, PropertyType: common.FieldTypeSingleChar, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "proc_num", PropertyName: "启动数量", IsRequired: false, IsOnly: false, IsEditable: true, PropertyGroup: mCommon.GroupNone, PropertyType: common.FieldTypeInt, Option: metadata.IntOption{Min: "1", Max: "1000000"}}, &Attribute{ObjectID: objID, PropertyID: "priority", PropertyName: "启动优先级", IsRequired: false, IsOnly: false, IsEditable: true, PropertyGroup: mCommon.GroupNone, PropertyType: common.FieldTypeInt, Option: metadata.IntOption{Min: "1", Max: "100"}}, &Attribute{ObjectID: objID, PropertyID: "timeout", PropertyName: "操作超时时长", IsRequired: false, IsOnly: false, IsEditable: true, PropertyGroup: mCommon.GroupNone, PropertyType: common.FieldTypeInt, Option: metadata.IntOption{Min: "1", Max: "1000000"}}, //gsekit 进程信息 &Attribute{ObjectID: objID, PropertyID: "start_cmd", PropertyName: "启动命令", IsRequired: false, IsOnly: false, IsEditable: true, PropertyGroup: mCommon.GroupNone, PropertyType: common.FieldTypeLongChar, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "stop_cmd", PropertyName: "停止命令", IsRequired: false, IsOnly: false, IsEditable: true, PropertyGroup: mCommon.GroupNone, PropertyType: common.FieldTypeLongChar, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "restart_cmd", PropertyName: "重启命令", IsRequired: false, IsOnly: false, IsEditable: true, PropertyGroup: mCommon.GroupNone, PropertyType: common.FieldTypeLongChar, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "face_stop_cmd", PropertyName: "强制停止命令", IsRequired: false, IsOnly: false, IsEditable: true, PropertyGroup: mCommon.GroupNone, PropertyType: common.FieldTypeLongChar, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "reload_cmd", PropertyName: "进程重载命令", IsRequired: false, IsOnly: false, IsEditable: true, PropertyGroup: mCommon.GroupNone, PropertyType: common.FieldTypeLongChar, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "pid_file", PropertyName: "PID文件路径", IsRequired: false, IsOnly: false, IsEditable: true, PropertyGroup: mCommon.GroupNone, PropertyType: common.FieldTypeLongChar, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "auto_start", PropertyName: "是否自动拉起", IsRequired: false, IsOnly: false, IsEditable: true, PropertyGroup: mCommon.GroupNone, PropertyType: common.FieldTypeBool, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "auto_time_gap", PropertyName: "拉起间隔", IsRequired: false, IsOnly: false, IsEditable: true, PropertyGroup: mCommon.GroupNone, PropertyType: common.FieldTypeInt, Option: metadata.IntOption{Min: "1", Max: "1000000"}}, } return dataRows } // SwitchRow proc structure func SwitchRow() []*Attribute { objID := common.BKInnerObjIDSwitch dataRows := []*Attribute{ &Attribute{ObjectID: objID, PropertyID: "bk_asset_id", PropertyName: "固资编号", IsRequired: true, IsOnly: true, IsPre: true, IsEditable: false, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeSingleChar, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "bk_inst_name", PropertyName: "名称", IsRequired: true, IsOnly: false, IsPre: true, IsEditable: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeSingleChar, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "bk_sn", PropertyName: "SN", IsRequired: false, IsOnly: false, IsPre: false, IsEditable: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeSingleChar, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "bk_func", PropertyName: "用途", IsRequired: false, IsOnly: false, IsPre: false, IsEditable: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeSingleChar, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "bk_vendor", PropertyName: "厂商", IsRequired: false, IsOnly: false, IsPre: false, IsEditable: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeSingleChar, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "bk_model", PropertyName: "设备型号", IsRequired: false, IsOnly: false, IsPre: false, IsEditable: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeSingleChar, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "bk_admin_ip", PropertyName: "管理IP", IsRequired: false, IsOnly: false, IsPre: false, IsEditable: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeSingleChar, Option: common.PatternMultipleIP}, &Attribute{ObjectID: objID, PropertyID: "bk_operator", PropertyName: "维护人", IsRequired: false, IsOnly: false, IsPre: false, IsEditable: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeSingleChar, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "bk_os_detail", PropertyName: "操作系统详情", IsRequired: false, IsOnly: false, IsPre: false, IsEditable: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeSingleChar, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "bk_detail", PropertyName: "详细描述", IsRequired: false, IsOnly: false, IsPre: false, IsEditable: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeLongChar, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "bk_biz_status", PropertyName: "运营状态", IsRequired: false, IsOnly: false, IsPre: false, IsEditable: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeEnum, Option: []metadata.EnumVal{{ID: "1", Name: "待运营", Type: "text"}, {ID: "2", Name: "运营中", Type: "text"}, {ID: "3", Name: "已下架", Type: "text"}}}, } return dataRows } // RouterRow proc structure func RouterRow() []*Attribute { objID := common.BKInnerObjIDRouter dataRows := []*Attribute{ &Attribute{ObjectID: objID, PropertyID: "bk_asset_id", PropertyName: "固资编号", IsRequired: true, IsOnly: true, IsPre: true, IsEditable: false, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeSingleChar, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "bk_inst_name", PropertyName: "名称", IsRequired: true, IsOnly: false, IsPre: true, IsEditable: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeSingleChar, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "bk_sn", PropertyName: "SN", IsRequired: false, IsOnly: false, IsPre: false, IsEditable: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeSingleChar, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "bk_func", PropertyName: "用途", IsRequired: false, IsOnly: false, IsPre: false, IsEditable: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeSingleChar, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "bk_vendor", PropertyName: "厂商", IsRequired: false, IsOnly: false, IsPre: false, IsEditable: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeSingleChar, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "bk_model", PropertyName: "设备型号", IsRequired: false, IsOnly: false, IsPre: false, IsEditable: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeSingleChar, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "bk_admin_ip", PropertyName: "管理IP", IsRequired: false, IsOnly: false, IsPre: false, IsEditable: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeSingleChar, Option: common.PatternMultipleIP}, &Attribute{ObjectID: objID, PropertyID: "bk_operator", PropertyName: "维护人", IsRequired: false, IsOnly: false, IsPre: false, IsEditable: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeSingleChar, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "bk_os_detail", PropertyName: "操作系统详情", IsRequired: false, IsOnly: false, IsPre: false, IsEditable: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeSingleChar, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "bk_detail", PropertyName: "详细描述", IsRequired: false, IsOnly: false, IsPre: false, IsEditable: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeLongChar, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "bk_biz_status", PropertyName: "运营状态", IsRequired: false, IsOnly: false, IsPre: false, IsEditable: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeEnum, Option: []metadata.EnumVal{{ID: "1", Name: "待运营", Type: "text"}, {ID: "2", Name: "运营中", Type: "text"}, {ID: "3", Name: "已下架", Type: "text"}}}, } return dataRows } // LoadBalanceRow proc structure func LoadBalanceRow() []*Attribute { objID := common.BKInnerObjIDBlance dataRows := []*Attribute{ &Attribute{ObjectID: objID, PropertyID: "bk_asset_id", PropertyName: "固资编号", IsRequired: true, IsOnly: true, IsPre: true, IsEditable: false, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeSingleChar, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "bk_inst_name", PropertyName: "名称", IsRequired: true, IsOnly: false, IsPre: true, IsEditable: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeSingleChar, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "bk_sn", PropertyName: "SN", IsRequired: false, IsOnly: false, IsPre: false, IsEditable: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeSingleChar, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "bk_func", PropertyName: "用途", IsRequired: false, IsOnly: false, IsPre: false, IsEditable: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeSingleChar, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "bk_vendor", PropertyName: "厂商", IsRequired: false, IsOnly: false, IsPre: false, IsEditable: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeSingleChar, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "bk_model", PropertyName: "设备型号", IsRequired: false, IsOnly: false, IsPre: false, IsEditable: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeSingleChar, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "bk_admin_ip", PropertyName: "管理IP", IsRequired: false, IsOnly: false, IsPre: false, IsEditable: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeSingleChar, Option: common.PatternMultipleIP}, &Attribute{ObjectID: objID, PropertyID: "bk_operator", PropertyName: "维护人", IsRequired: false, IsOnly: false, IsPre: false, IsEditable: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeSingleChar, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "bk_os_detail", PropertyName: "操作系统详情", IsRequired: false, IsOnly: false, IsPre: false, IsEditable: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeSingleChar, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "bk_detail", PropertyName: "详细描述", IsRequired: false, IsOnly: false, IsPre: false, IsEditable: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeLongChar, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "bk_biz_status", PropertyName: "运营状态", IsRequired: false, IsOnly: false, IsPre: false, IsEditable: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeEnum, Option: []metadata.EnumVal{{ID: "1", Name: "待运营", Type: "text"}, {ID: "2", Name: "运营中", Type: "text"}, {ID: "3", Name: "已下架", Type: "text"}}}, } return dataRows } // FirewallRow proc structure func FirewallRow() []*Attribute { objID := common.BKInnerObjIDFirewall dataRows := []*Attribute{ &Attribute{ObjectID: objID, PropertyID: "bk_asset_id", PropertyName: "固资编号", IsRequired: true, IsOnly: true, IsPre: true, IsEditable: false, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeSingleChar, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "bk_inst_name", PropertyName: "名称", IsRequired: true, IsOnly: false, IsPre: true, IsEditable: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeSingleChar, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "bk_sn", PropertyName: "SN", IsRequired: false, IsOnly: false, IsPre: false, IsEditable: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeSingleChar, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "bk_func", PropertyName: "用途", IsRequired: false, IsOnly: false, IsPre: false, IsEditable: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeSingleChar, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "bk_vendor", PropertyName: "厂商", IsRequired: false, IsOnly: false, IsPre: false, IsEditable: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeSingleChar, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "bk_model", PropertyName: "设备型号", IsRequired: false, IsOnly: false, IsPre: false, IsEditable: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeSingleChar, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "bk_admin_ip", PropertyName: "管理IP", IsRequired: false, IsOnly: false, IsPre: false, IsEditable: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeSingleChar, Option: common.PatternMultipleIP}, &Attribute{ObjectID: objID, PropertyID: "bk_operator", PropertyName: "维护人", IsRequired: false, IsOnly: false, IsPre: false, IsEditable: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeSingleChar, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "bk_os_detail", PropertyName: "操作系统详情", IsRequired: false, IsOnly: false, IsPre: false, IsEditable: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeSingleChar, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "bk_detail", PropertyName: "详细描述", IsRequired: false, IsOnly: false, IsPre: false, IsEditable: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeLongChar, Option: ""}, &Attribute{ObjectID: objID, PropertyID: "bk_biz_status", PropertyName: "运营状态", IsRequired: false, IsOnly: false, IsPre: false, IsEditable: true, PropertyGroup: groupBaseInfo, PropertyType: common.FieldTypeEnum, Option: []metadata.EnumVal{{ID: "1", Name: "待运营", Type: "text"}, {ID: "2", Name: "运营中", Type: "text"}, {ID: "3", Name: "已下架", Type: "text"}}}, } return dataRows } var stateEnum = []metadata.EnumVal{ {ID: "AR", Name: "阿根廷", Type: "text"}, {ID: "AD", Name: "安道尔", Type: "text"}, {ID: "AE", Name: "阿联酋", Type: "text"}, {ID: "AF", Name: "阿富汗", Type: "text"}, {ID: "AG", Name: "安提瓜和巴布达", Type: "text"}, {ID: "AI", Name: "安圭拉", Type: "text"}, {ID: "AL", Name: "阿尔巴尼亚", Type: "text"}, {ID: "AM", Name: "亚美尼亚", Type: "text"}, {ID: "AO", Name: "安哥拉", Type: "text"}, {ID: "AQ", Name: "南极洲", Type: "text"}, {ID: "AS", Name: "美属萨摩亚", Type: "text"}, {ID: "AT", Name: "奥地利", Type: "text"}, {ID: "AU", Name: "澳大利亚", Type: "text"}, {ID: "AW", Name: "阿鲁巴", Type: "text"}, {ID: "AX", Name: "奥兰群岛", Type: "text"}, {ID: "AZ", Name: "阿塞拜疆", Type: "text"}, {ID: "BA", Name: "波黑", Type: "text"}, {ID: "BB", Name: "巴巴多斯", Type: "text"}, {ID: "BD", Name: "孟加拉", Type: "text"}, {ID: "BE", Name: "比利时", Type: "text"}, {ID: "BF", Name: "布基纳法索", Type: "text"}, {ID: "BG", Name: "保加利亚", Type: "text"}, {ID: "BH", Name: "巴林", Type: "text"}, {ID: "BI", Name: "布隆迪", Type: "text"}, {ID: "BJ", Name: "贝宁", Type: "text"}, {ID: "BL", Name: "圣巴泰勒米岛", Type: "text"}, {ID: "BM", Name: "百慕大", Type: "text"}, {ID: "BN", Name: "文莱", Type: "text"}, {ID: "BO", Name: "玻利维亚", Type: "text"}, {ID: "BQ", Name: "荷兰加勒比区", Type: "text"}, {ID: "BR", Name: "巴西", Type: "text"}, {ID: "BS", Name: "巴哈马", Type: "text"}, {ID: "BT", Name: "不丹", Type: "text"}, {ID: "BV", Name: "布韦岛", Type: "text"}, {ID: "BW", Name: "博茨瓦纳", Type: "text"}, {ID: "BY", Name: "白俄罗斯", Type: "text"}, {ID: "BZ", Name: "伯利兹", Type: "text"}, {ID: "CA", Name: "加拿大", Type: "text"}, {ID: "CC", Name: "科科斯群岛", Type: "text"}, {ID: "CD", Name: "刚果(金)", Type: "text"}, {ID: "CF", Name: "中非", Type: "text"}, {ID: "CG", Name: "刚果(布)", Type: "text"}, {ID: "CH", Name: "瑞士", Type: "text"}, {ID: "CI", Name: "科特迪瓦", Type: "text"}, {ID: "CK", Name: "库克群岛", Type: "text"}, {ID: "CL", Name: "智利", Type: "text"}, {ID: "CM", Name: "喀麦隆", Type: "text"}, {ID: "CN", Name: "中国", Type: "text"}, {ID: "CO", Name: "哥伦比亚", Type: "text"}, {ID: "CR", Name: "哥斯达黎加", Type: "text"}, {ID: "CU", Name: "古巴", Type: "text"}, {ID: "CV", Name: "佛得角", Type: "text"}, {ID: "CW", Name: "库拉索", Type: "text"}, {ID: "CX", Name: "圣诞岛", Type: "text"}, {ID: "CY", Name: "塞浦路斯", Type: "text"}, {ID: "CZ", Name: "捷克", Type: "text"}, {ID: "DE", Name: "德国", Type: "text"}, {ID: "DJ", Name: "吉布提", Type: "text"}, {ID: "DK", Name: "丹麦", Type: "text"}, {ID: "DM", Name: "多米尼克", Type: "text"}, {ID: "DO", Name: "多米尼加", Type: "text"}, {ID: "DZ", Name: "阿尔及利亚", Type: "text"}, {ID: "EC", Name: "厄瓜多尔", Type: "text"}, {ID: "EE", Name: "爱沙尼亚", Type: "text"}, {ID: "EG", Name: "埃及", Type: "text"}, {ID: "EH", Name: "西撒哈拉", Type: "text"}, {ID: "ER", Name: "厄立特里亚", Type: "text"}, {ID: "ES", Name: "西班牙", Type: "text"}, {ID: "ET", Name: "埃塞俄比亚", Type: "text"}, {ID: "FI", Name: "芬兰", Type: "text"}, {ID: "FJ", Name: "斐济群岛", Type: "text"}, {ID: "FK", Name: "马尔维纳斯群岛(福克兰)", Type: "text"}, {ID: "FM", Name: "密克罗尼西亚联邦", Type: "text"}, {ID: "FO", Name: "法罗群岛", Type: "text"}, {ID: "FR", Name: "法国", Type: "text"}, {ID: "GA", Name: "加蓬", Type: "text"}, {ID: "GB", Name: "英国", Type: "text"}, {ID: "GD", Name: "格林纳达", Type: "text"}, {ID: "GE", Name: "格鲁吉亚", Type: "text"}, {ID: "GF", Name: "法属圭亚那", Type: "text"}, {ID: "GG", Name: "根西岛", Type: "text"}, {ID: "GH", Name: "加纳", Type: "text"}, {ID: "GI", Name: "直布罗陀", Type: "text"}, {ID: "GL", Name: "格陵兰", Type: "text"}, {ID: "GM", Name: "冈比亚", Type: "text"}, {ID: "GN", Name: "几内亚", Type: "text"}, {ID: "GP", Name: "瓜德罗普", Type: "text"}, {ID: "GQ", Name: "赤道几内亚", Type: "text"}, {ID: "GR", Name: "希腊", Type: "text"}, {ID: "GS", Name: "南乔治亚岛和南桑威奇群岛", Type: "text"}, {ID: "GT", Name: "危地马拉", Type: "text"}, {ID: "GU", Name: "关岛", Type: "text"}, {ID: "GW", Name: "几内亚比绍", Type: "text"}, {ID: "GY", Name: "圭亚那", Type: "text"}, {ID: "HM", Name: "赫德岛和麦克唐纳群岛", Type: "text"}, {ID: "HN", Name: "洪都拉斯", Type: "text"}, {ID: "HR", Name: "克罗地亚", Type: "text"}, {ID: "HT", Name: "海地", Type: "text"}, {ID: "HU", Name: "匈牙利", Type: "text"}, {ID: "ID", Name: "印尼", Type: "text"}, {ID: "IE", Name: "爱尔兰", Type: "text"}, {ID: "IL", Name: "以色列", Type: "text"}, {ID: "IM", Name: "马恩岛", Type: "text"}, {ID: "IN", Name: "印度", Type: "text"}, {ID: "IO", Name: "英属印度洋领地", Type: "text"}, {ID: "IQ", Name: "伊拉克", Type: "text"}, {ID: "IR", Name: "伊朗", Type: "text"}, {ID: "IS", Name: "冰岛", Type: "text"}, {ID: "IT", Name: "意大利", Type: "text"}, {ID: "JE", Name: "泽西岛", Type: "text"}, {ID: "JM", Name: "牙买加", Type: "text"}, {ID: "JO", Name: "约旦", Type: "text"}, {ID: "JP", Name: "日本", Type: "text"}, {ID: "KE", Name: "肯尼亚", Type: "text"}, {ID: "KG", Name: "吉尔吉斯斯坦", Type: "text"}, {ID: "KH", Name: "柬埔寨", Type: "text"}, {ID: "KI", Name: "基里巴斯", Type: "text"}, {ID: "KM", Name: "科摩罗", Type: "text"}, {ID: "KN", Name: "圣基茨和尼维斯", Type: "text"}, {ID: "KP", Name: "朝鲜", Type: "text"}, {ID: "KR", Name: "韩国", Type: "text"}, {ID: "KW", Name: "科威特", Type: "text"}, {ID: "KY", Name: "开曼群岛", Type: "text"}, {ID: "KZ", Name: "哈萨克斯坦", Type: "text"}, {ID: "LA", Name: "老挝", Type: "text"}, {ID: "LB", Name: "黎巴嫩", Type: "text"}, {ID: "LC", Name: "圣卢西亚", Type: "text"}, {ID: "LI", Name: "列支敦士登", Type: "text"}, {ID: "LK", Name: "斯里兰卡", Type: "text"}, {ID: "LR", Name: "利比里亚", Type: "text"}, {ID: "LS", Name: "莱索托", Type: "text"}, {ID: "LT", Name: "立陶宛", Type: "text"}, {ID: "LU", Name: "卢森堡", Type: "text"}, {ID: "LV", Name: "拉脱维亚", Type: "text"}, {ID: "LY", Name: "利比亚", Type: "text"}, {ID: "MA", Name: "摩洛哥", Type: "text"}, {ID: "MC", Name: "摩纳哥", Type: "text"}, {ID: "MD", Name: "摩尔多瓦", Type: "text"}, {ID: "ME", Name: "黑山", Type: "text"}, {ID: "MF", Name: "法属圣马丁", Type: "text"}, {ID: "MG", Name: "马达加斯加", Type: "text"}, {ID: "MH", Name: "马绍尔群岛", Type: "text"}, {ID: "MK", Name: "马其顿", Type: "text"}, {ID: "ML", Name: "马里", Type: "text"}, {ID: "MM", Name: "缅甸", Type: "text"}, {ID: "MN", Name: "蒙古国", Type: "text"}, {ID: "MP", Name: "北马里亚纳群岛", Type: "text"}, {ID: "MQ", Name: "马提尼克", Type: "text"}, {ID: "MR", Name: "毛里塔尼亚", Type: "text"}, {ID: "MS", Name: "蒙塞拉特岛", Type: "text"}, {ID: "MT", Name: "马耳他", Type: "text"}, {ID: "MU", Name: "毛里求斯", Type: "text"}, {ID: "MV", Name: "马尔代夫", Type: "text"}, {ID: "MW", Name: "马拉维", Type: "text"}, {ID: "MX", Name: "墨西哥", Type: "text"}, {ID: "MY", Name: "马来西亚", Type: "text"}, {ID: "MZ", Name: "莫桑比克", Type: "text"}, {ID: "NA", Name: "纳米比亚", Type: "text"}, {ID: "NC", Name: "新喀里多尼亚", Type: "text"}, {ID: "NE", Name: "尼日尔", Type: "text"}, {ID: "NF", Name: "诺福克岛", Type: "text"}, {ID: "NG", Name: "尼日利亚", Type: "text"}, {ID: "NI", Name: "尼加拉瓜", Type: "text"}, {ID: "NL", Name: "荷兰", Type: "text"}, {ID: "NO", Name: "挪威", Type: "text"}, {ID: "NP", Name: "尼泊尔", Type: "text"}, {ID: "NR", Name: "瑙鲁", Type: "text"}, {ID: "NU", Name: "纽埃", Type: "text"}, {ID: "NZ", Name: "新西兰", Type: "text"}, {ID: "OM", Name: "阿曼", Type: "text"}, {ID: "PA", Name: "巴拿马", Type: "text"}, {ID: "PE", Name: "秘鲁", Type: "text"}, {ID: "PF", Name: "法属波利尼西亚", Type: "text"}, {ID: "PG", Name: "巴布亚新几内亚", Type: "text"}, {ID: "PH", Name: "菲律宾", Type: "text"}, {ID: "PK", Name: "巴基斯坦", Type: "text"}, {ID: "PL", Name: "波兰", Type: "text"}, {ID: "PM", Name: "圣皮埃尔和密克隆", Type: "text"}, {ID: "PN", Name: "皮特凯恩群岛", Type: "text"}, {ID: "PR", Name: "波多黎各", Type: "text"}, {ID: "PS", Name: "巴勒斯坦", Type: "text"}, {ID: "PT", Name: "葡萄牙", Type: "text"}, {ID: "PW", Name: "帕劳", Type: "text"}, {ID: "PY", Name: "巴拉圭", Type: "text"}, {ID: "QA", Name: "卡塔尔", Type: "text"}, {ID: "RE", Name: "留尼汪", Type: "text"}, {ID: "RO", Name: "罗马尼亚", Type: "text"}, {ID: "RS", Name: "塞尔维亚", Type: "text"}, {ID: "RU", Name: "俄罗斯", Type: "text"}, {ID: "RW", Name: "卢旺达", Type: "text"}, {ID: "SA", Name: "沙特阿拉伯", Type: "text"}, {ID: "SB", Name: "所罗门群岛", Type: "text"}, {ID: "SC", Name: "塞舌尔", Type: "text"}, {ID: "SD", Name: "苏丹", Type: "text"}, {ID: "SE", Name: "瑞典", Type: "text"}, {ID: "SG", Name: "新加坡", Type: "text"}, {ID: "SH", Name: "圣赫勒拿", Type: "text"}, {ID: "SI", Name: "斯洛文尼亚", Type: "text"}, {ID: "SJ", Name: "斯瓦尔巴群岛和扬马延岛", Type: "text"}, {ID: "SK", Name: "斯洛伐克", Type: "text"}, {ID: "SL", Name: "塞拉利昂", Type: "text"}, {ID: "SM", Name: "圣马力诺", Type: "text"}, {ID: "SN", Name: "塞内加尔", Type: "text"}, {ID: "SO", Name: "索马里", Type: "text"}, {ID: "SR", Name: "苏里南", Type: "text"}, {ID: "SS", Name: "南苏丹", Type: "text"}, {ID: "ST", Name: "圣多美和普林西比", Type: "text"}, {ID: "SV", Name: "萨尔瓦多", Type: "text"}, {ID: "SX", Name: "荷属圣马丁", Type: "text"}, {ID: "SY", Name: "叙利亚", Type: "text"}, {ID: "SZ", Name: "斯威士兰", Type: "text"}, {ID: "TC", Name: "特克斯和凯科斯群岛", Type: "text"}, {ID: "TD", Name: "乍得", Type: "text"}, {ID: "TF", Name: "法属南部领地", Type: "text"}, {ID: "TG", Name: "多哥", Type: "text"}, {ID: "TH", Name: "泰国", Type: "text"}, {ID: "TJ", Name: "塔吉克斯坦", Type: "text"}, {ID: "TK", Name: "托克劳", Type: "text"}, {ID: "TL", Name: "东帝汶", Type: "text"}, {ID: "TM", Name: "土库曼斯坦", Type: "text"}, {ID: "TN", Name: "突尼斯", Type: "text"}, {ID: "TO", Name: "汤加", Type: "text"}, {ID: "TR", Name: "土耳其", Type: "text"}, {ID: "TT", Name: "特立尼达和多巴哥", Type: "text"}, {ID: "TV", Name: "图瓦卢", Type: "text"}, {ID: "TZ", Name: "坦桑尼亚", Type: "text"}, {ID: "UA", Name: "乌克兰", Type: "text"}, {ID: "UG", Name: "乌干达", Type: "text"}, {ID: "UM", Name: "美国本土外小岛屿", Type: "text"}, {ID: "UY", Name: "乌拉圭", Type: "text"}, {ID: "UZ", Name: "乌兹别克斯坦", Type: "text"}, {ID: "VA", Name: "梵蒂冈", Type: "text"}, {ID: "VC", Name: "圣文森特和格林纳丁斯", Type: "text"}, {ID: "VE", Name: "委内瑞拉", Type: "text"}, {ID: "VG", Name: "英属维尔京群岛", Type: "text"}, {ID: "VI", Name: "美属维尔京群岛", Type: "text"}, {ID: "VN", Name: "越南", Type: "text"}, {ID: "US", Name: "美国", Type: "text"}, {ID: "VU", Name: "瓦努阿图", Type: "text"}, {ID: "WF", Name: "瓦利斯和富图纳", Type: "text"}, {ID: "WS", Name: "萨摩亚", Type: "text"}, {ID: "YE", Name: "也门", Type: "text"}, {ID: "YT", Name: "马约特", Type: "text"}, {ID: "ZA", Name: "南非", Type: "text"}, {ID: "ZM", Name: "赞比亚", Type: "text"}, {ID: "ZW", Name: "津巴布韦", Type: "text"}, } var provincesEnum = []metadata.EnumVal{ {ID: "110000", Name: "北京市", Type: "text"}, {ID: "120000", Name: "天津市", Type: "text"}, {ID: "130000", Name: "河北省", Type: "text"}, {ID: "140000", Name: "山西省", Type: "text"}, {ID: "150000", Name: "内蒙古自治区", Type: "text"}, {ID: "210000", Name: "辽宁省", Type: "text"}, {ID: "220000", Name: "吉林省", Type: "text"}, {ID: "230000", Name: "黑龙江省", Type: "text"}, {ID: "310000", Name: "上海市", Type: "text"}, {ID: "320000", Name: "江苏省", Type: "text"}, {ID: "330000", Name: "浙江省", Type: "text"}, {ID: "340000", Name: "安徽省", Type: "text"}, {ID: "350000", Name: "福建省", Type: "text"}, {ID: "360000", Name: "江西省", Type: "text"}, {ID: "370000", Name: "山东省", Type: "text"}, {ID: "410000", Name: "河南省", Type: "text"}, {ID: "420000", Name: "湖北省", Type: "text"}, {ID: "430000", Name: "湖南省", Type: "text"}, {ID: "440000", Name: "广东省", Type: "text"}, {ID: "450000", Name: "广西壮族自治区", Type: "text"}, {ID: "460000", Name: "海南省", Type: "text"}, {ID: "500000", Name: "重庆市", Type: "text"}, {ID: "510000", Name: "四川省", Type: "text"}, {ID: "520000", Name: "贵州省", Type: "text"}, {ID: "530000", Name: "云南省", Type: "text"}, {ID: "540000", Name: "西藏自治区", Type: "text"}, {ID: "610000", Name: "陕西省", Type: "text"}, {ID: "620000", Name: "甘肃省", Type: "text"}, {ID: "630000", Name: "青海省", Type: "text"}, {ID: "640000", Name: "宁夏回族自治区", Type: "text"}, {ID: "650000", Name: "新疆维吾尔自治区", Type: "text"}, {ID: "710000", Name: "台湾省", Type: "text"}, {ID: "810000", Name: "香港特别行政区", Type: "text"}, {ID: "820000", Name: "澳门特别行政区", Type: "text"}, } var ispNameEnum = []metadata.EnumVal{ {ID: "0", Name: "其他", Type: "text"}, {ID: "1", Name: "电信", Type: "text"}, {ID: "2", Name: "联通", Type: "text"}, {ID: "3", Name: "移动", Type: "text"}, } type Attribute struct { ID int64 `field:"id" json:"id" bson:"id"` OwnerID string `field:"bk_supplier_account" json:"bk_supplier_account" bson:"bk_supplier_account"` ObjectID string `field:"bk_obj_id" json:"bk_obj_id" bson:"bk_obj_id"` PropertyID string `field:"bk_property_id" json:"bk_property_id" bson:"bk_property_id"` PropertyName string `field:"bk_property_name" json:"bk_property_name" bson:"bk_property_name"` PropertyGroup string `field:"bk_property_group" json:"bk_property_group" bson:"bk_property_group"` PropertyGroupName string `field:"bk_property_group_name,ignoretomap" json:"bk_property_group_name" bson:"-"` PropertyIndex int64 `field:"bk_property_index" json:"bk_property_index" bson:"bk_property_index"` Unit string `field:"unit" json:"unit" bson:"unit"` Placeholder string `field:"placeholder" json:"placeholder" bson:"placeholder"` IsEditable bool `field:"editable" json:"editable" bson:"editable"` IsPre bool `field:"ispre" json:"ispre" bson:"ispre"` IsRequired bool `field:"isrequired" json:"isrequired" bson:"isrequired"` IsReadOnly bool `field:"isreadonly" json:"isreadonly" bson:"isreadonly"` IsOnly bool `field:"isonly" json:"isonly" bson:"isonly"` IsSystem bool `field:"bk_issystem" json:"bk_issystem" bson:"bk_issystem"` IsAPI bool `field:"bk_isapi" json:"bk_isapi" bson:"bk_isapi"` PropertyType string `field:"bk_property_type" json:"bk_property_type" bson:"bk_property_type"` Option interface{} `field:"option" json:"option" bson:"option"` Description string `field:"description" json:"description" bson:"description"` Creator string `field:"creator" json:"creator" bson:"creator"` CreateTime *time.Time `json:"create_time" bson:"create_time"` LastTime *time.Time `json:"last_time" bson:"last_time"` }
<gh_stars>0 package IA.probAntenas; import java.util.ArrayList; import java.util.List; import aima.search.framework.Successor; import aima.search.framework.SuccessorFunction; /** * @author <NAME> * */ public class ProbAntenasSuccessorFunction implements SuccessorFunction { public List getSuccessors(Object aState) { ArrayList retVal= new ArrayList(); ProbAntenasBoard board=(ProbAntenasBoard) aState; for(int i=0;i<board.getNumAntenas();i++){ // Movemos hacia Arriba ProbAntenasBoard newBoardU= new ProbAntenasBoard(board.getNumAntenas(),board.getMaxPotencia(),board.getAntenas(),board.getDimPlano(),board.getPlano()); if (newBoardU.MoverAntena(i, -1,0)) { String S=new String(ProbAntenasBoard.MOVER+" "+i+" Up"); retVal.add(new Successor(S,newBoardU)); } // Movemos hacia Abajo ProbAntenasBoard newBoardD= new ProbAntenasBoard(board.getNumAntenas(),board.getMaxPotencia(),board.getAntenas(),board.getDimPlano(),board.getPlano()); if (newBoardD.MoverAntena(i, 1,0)) { String S=new String(ProbAntenasBoard.MOVER+" "+i+" Down"); retVal.add(new Successor(S,newBoardD)); } // Movemos hacia la izquierda ProbAntenasBoard newBoardL= new ProbAntenasBoard(board.getNumAntenas(),board.getMaxPotencia(),board.getAntenas(),board.getDimPlano(),board.getPlano()); if (newBoardL.MoverAntena(i, 0, -1)) { String S=new String(ProbAntenasBoard.MOVER+" "+i+" Left"); retVal.add(new Successor(S,newBoardL)); } // Movemos hacia la derecha ProbAntenasBoard newBoardR= new ProbAntenasBoard(board.getNumAntenas(),board.getMaxPotencia(),board.getAntenas(),board.getDimPlano(),board.getPlano()); if (newBoardR.MoverAntena(i, 0,1)) { String S=new String(ProbAntenasBoard.MOVER+" "+i+ "Right"); retVal.add(new Successor(S,newBoardR)); } ProbAntenasBoard newBoardPU= new ProbAntenasBoard(board.getNumAntenas(),board.getMaxPotencia(),board.getAntenas(),board.getDimPlano(),board.getPlano()); if (newBoardPU.aumentaPotencia(i)) { String S=new String(ProbAntenasBoard.AUMENTAR+" "+i); retVal.add(new Successor(S,newBoardPU)); } ProbAntenasBoard newBoardPD= new ProbAntenasBoard(board.getNumAntenas(),board.getMaxPotencia(),board.getAntenas(),board.getDimPlano(),board.getPlano()); if (newBoardPD.disminuyePotencia(i)) { String S=new String(ProbAntenasBoard.DISMINUIR+" "+i); retVal.add(new Successor(S,newBoardPD)); } } return retVal; } }
<filename>test/services/api-catalog.service.tests.js const expect = require('expect.js'); const sinon = require('sinon'); const _ = require('lodash'); const esHelpers = require('../helpers/es2-fixture'); const KubernetesService = require('../../app/services/kubernetes.service'); const SwaggerService = require('../../app/services/swagger.service'); const APICatalogService = require('../../app/services/api-catalog.service'); const NAMESPACES = require('../fixtures/kubernetes/namespaces.json'); const SWAGGER_JSON = require('../fixtures/swagger/swagger.json'); describe('API Catalog Service tests', () => { let getNamespacesStub; let getNamespaceIngressesStub; let getSwaggerFileStub; const ingressLabelsGroupgithub = { 'codekube.io/service.name': 'quotes', 'codekube.io/service.version': '2.0', 'codekube.io/service.group': 'github', 'codekube.io/service.env': 'local' }; const ingressLabelsGroupCLOUD = { 'codekube.io/service.name': 'uptimes', 'codekube.io/service.version': '3.0', 'codekube.io/service.group': 'cloud', 'codekube.io/service.env': 'prod' }; beforeEach((done) => { // stub services // call index 5 (6th) call is with namespace `otherNamespaceName-qa`, which was already added in random.json es fixtures, thus should be deleted getSwaggerFileStub = sinon.stub(SwaggerService, 'getSwaggerFile'); getSwaggerFileStub.resolves(SWAGGER_JSON); getSwaggerFileStub.onCall(5).rejects('error'); // on call 0,1,2,3 only getNamespaceIngressesStub = sinon.stub(KubernetesService, 'getAllNamespaceIngressesServiceLabels'); getNamespaceIngressesStub.onCall(0).resolves(ingressLabelsGroupgithub); getNamespaceIngressesStub.onCall(1).resolves(ingressLabelsGroupCLOUD); getNamespaceIngressesStub.onCall(2).resolves(ingressLabelsGroupCLOUD); getNamespaceIngressesStub.rejects('error'); getNamespacesStub = sinon.stub(KubernetesService, 'getNamespaces').resolves(NAMESPACES.items); // make sure only the random.json ES fixtures is loaded // this simulates the existing data in ES, which should never be tempered esHelpers.deleteAll() .then(() => esHelpers.getAll()) .then(apis => { expect(apis.length).to.equal(0); return esHelpers.loadAll(); }) .then(() => esHelpers.getAll()) .then(apis => { expect(apis.length).to.equal(4); done(); }) .catch(done); }); afterEach((done) => { // restore all stubs getNamespacesStub.restore(); getNamespaceIngressesStub.restore(); getSwaggerFileStub.restore(); esHelpers.deleteAll() .then(() => esHelpers.getAll()) .then(apis => { expect(apis.length).to.equal(0); done(); }) .catch(done); }); describe('writeApiEntries', () => { it('should create correct Swagger ES entries, and delete outdated ones', (done) => { APICatalogService.writeApiEntries() .then(() => { setTimeout(() => { // after 1 second, get all esHelpers.getAll() .then(apis => { expect(getNamespacesStub.callCount).to.equal(1); expect(getNamespaceIngressesStub.callCount).to.equal(6); expect(getSwaggerFileStub.callCount).to.equal(6); // 4 in random.json, + 6 namespaces Swagger files // but 1 Swagger failed to fetch, which was already // present in ES, so it got deleted, thus 8 in total expect(apis.length).to.equal(8); }) .then(() => APICatalogService.searchAPICatalog()) .then(catalogApis => { // only 5/8 are actual API Catalog apis expect(catalogApis.length).to.equal(5); // TODO: When !serviceGroup, namespace is not taken into account for sorting. Use _script? // REAL EXPECTED: namespaceName-develop', 'namespaceName-qa', 'namespaceName', 'otherNamespaceName', 'otherNamespaceName-develop' // should be sorted by serviceGroup, serviceName, namespace expect(catalogApis.map(api => api.namespace)).to.eql([ 'namespaceName-develop', 'namespaceName-qa', 'namespaceName', 'otherNamespaceName-develop', 'otherNamespaceName' ]); // let's test dev-only catalog return APICatalogService.searchAPICatalog('dev'); }) .then(catalogApis => { // only 2 are dev API Catalog apis expect(catalogApis.length).to.equal(2); // let's test if we returned are the fields we need const namespaceNameDevelopApi = _.find(catalogApis, { namespace: 'namespaceName-develop' }); const otherNamespaceNameDevelopApi = _.find(catalogApis, { namespace: 'otherNamespaceName-develop' }); expect(namespaceNameDevelopApi).to.eql({ repo: { owner: 'owner1', name: 'repo2' }, info: { title: 'Swagger Petstore', description: 'This is a sample server Petstore server.', }, namespace: 'namespaceName-develop', serviceName: 'uptimes', serviceGroup: 'cloud' }); expect(otherNamespaceNameDevelopApi).to.eql({ repo: { owner: 'owner2', name: 'repo2' }, info: { title: 'Swagger Petstore', description: 'This is a sample server Petstore server.', }, namespace: 'otherNamespaceName-develop' }); return APICatalogService.searchAPICatalog('qa'); }) .then(catalogApis => { // only 1 are qa API Catalog apis (other qa failed to fetch Swagger), remember? expect(catalogApis.length).to.equal(1); const namespaceNameQAApi = _.find(catalogApis, { namespace: 'namespaceName-qa' }); expect(namespaceNameQAApi).to.eql({ repo: { owner: 'owner1', name: 'repo3' }, info: { title: 'Swagger Petstore', description: 'This is a sample server Petstore server.', }, namespace: 'namespaceName-qa', serviceName: 'uptimes', serviceGroup: 'cloud' }); return APICatalogService.searchAPICatalog('prod'); }) .then(catalogApis => { // only 2 are prod API Catalog apis expect(catalogApis.length).to.equal(2); const namespaceNameProdApi = _.find(catalogApis, { namespace: 'namespaceName' }); const otherNamespaceNameProdApi = _.find(catalogApis, { namespace: 'otherNamespaceName' }); expect(namespaceNameProdApi).to.eql({ repo: { owner: 'owner1', name: 'repo1' }, info: { title: 'Swagger Petstore', description: 'This is a sample server Petstore server.', }, namespace: 'namespaceName', serviceName: 'quotes', serviceGroup: 'github' }); expect(otherNamespaceNameProdApi).to.eql({ repo: { owner: 'owner2', name: 'repo1' }, info: { title: 'Swagger Petstore', description: 'This is a sample server Petstore server.', }, namespace: 'otherNamespaceName' }); // all is well :) done(); }) .catch(done); }, 1000); }) .catch(done); }).timeout(5000); // we need more time because of the setTimeouts }); describe('searchAPICatalog', () => { it('should properly search in all fields', (done) => { APICatalogService.writeApiEntries() .then(() => { setTimeout(() => { // after 1 second, get all esHelpers.getAll() .then(apis => { expect(getNamespacesStub.callCount).to.equal(1); expect(getNamespaceIngressesStub.callCount).to.equal(6); expect(getSwaggerFileStub.callCount).to.equal(6); // 4 in random.json, + 6 namespaces Swagger files // but 1 Swagger failed to fetch, which was already // present in ES, so it got deleted, thus 8 in total expect(apis.length).to.equal(8); }) .then(() => APICatalogService.searchAPICatalog('*')) .then(catalogApis => { // only 5/8 are actual API Catalog apis expect(catalogApis.length).to.equal(5); // let's test dev-only catalog return APICatalogService.searchAPICatalog('dev'); }) .then(catalogApis => { // only 2 are dev API Catalog apis expect(catalogApis.length).to.equal(2); // let's test qa-only catalog return APICatalogService.searchAPICatalog('qa'); }) .then(catalogApis => { // only 1 are qa API Catalog apis (other qa failed to fetch Swagger), remember? expect(catalogApis.length).to.equal(1); // let's test prod-only catalog return APICatalogService.searchAPICatalog('prod'); }) .then(catalogApis => { // only 2 are prod API Catalog apis expect(catalogApis.length).to.equal(2); // now let's test the same using namespaceName, in dev return APICatalogService.searchAPICatalog('dev', null, 'amespaceNam'); }) .then(catalogApis => { expect(catalogApis.length).to.equal(2); // now let's test the same using serviceGroup, in dev return APICatalogService.searchAPICatalog('dev', null, 'is IS a Sample SERVER Petstore'); }) .then(catalogApis => { expect(catalogApis.length).to.equal(2); // now let's test the same using repo2, in dev return APICatalogService.searchAPICatalog('dev', null, 'EPO2'); }) .then(catalogApis => { expect(catalogApis.length).to.equal(2); // now let's test the same using therNamespace, spec, dev (in namespaceName-develop) in * environments return APICatalogService.searchAPICatalog('*', null, 'therNamespaceName, PETStore , evelo'); }) .then(catalogApis => { expect(catalogApis.length).to.equal(1); // now let's search with serviceGroup CLOUD return APICatalogService.searchAPICatalog('*', 'ClOuD'); }) .then(catalogApis => { expect(catalogApis.length).to.equal(2); // now let's search with serviceGroup github return APICatalogService.searchAPICatalog('*', 'github'); }) .then(catalogApis => { expect(catalogApis.length).to.equal(1); // now let's search with a substring serviceGroup (should not work) return APICatalogService.searchAPICatalog('*', 'CLO'); }) .then(catalogApis => { expect(catalogApis.length).to.equal(0); // now let's search with an unknown serviceGroup return APICatalogService.searchAPICatalog('*', 'iAmUnknowngithubClOuDServiceGroup'); }) .then(catalogApis => { expect(catalogApis.length).to.equal(0); // now let's search with a combination of serviceGroup/searchTerms return APICatalogService.searchAPICatalog('*', 'ClOuD', 'namespaceName, repo2'); }) .then(catalogApis => { expect(catalogApis.length).to.equal(1); // all is well :) done(); }) .catch(done); }, 1000); }) .catch(done); }).timeout(5000); // we need more time because of the setTimeouts }); describe('getServiceGroups', () => { it('should return all serviceGroups, without null ones', (done) => { APICatalogService.writeApiEntries() .then(() => { setTimeout(() => { // after 1 second, get serviceGroups APICatalogService.getServiceGroups() .then(serviceGroups => { expect(serviceGroups).to.eql( { total: 5, serviceGroups: [ { key: 'cloud', doc_count: 2 }, { key: 'github', doc_count: 1 } ] }); done(); }) .catch(done); }, 1000); }); }).timeout(5000); // we need more time because of the setTimeouts }); });
from glob import glob def simulate_angular_distribution(element, potential_file, nplanes, energy_level): # Define the potential for the cluster pot = SPRKKRPotential(element, potential_file, *glob("*PHAGEN.pot")) # Create a hemispherical cluster of atoms cluster = hemispherical_cluster(element, planes=nplanes, emitter_plane=nplanes-1) cluster.absorber = get_atom_index(cluster, 0, 0, 0) # Set up the calculation calc = MSSPEC(folder="calc") calc.set_atoms(cluster) calc.tmatrix_parameters.potential = pot # Obtain the angular distribution data for photoelectrons at the specified energy level data = calc.get_theta_scan(level=energy_level) return data
<reponame>KevinOrtman/tsquery /* * Copyright 2011 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* Copyright 2013 <NAME> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.tsquery.data.hbase; public class DataPointQualifier { private static final int QUALIFIER_BYTES = 2; private static final int QUALIFIER_FLAGS_BITS = 4; public static byte[] packedOffset(long offset) { byte[] packed = new byte[QUALIFIER_BYTES]; offset = offset << QUALIFIER_FLAGS_BITS; long shift = 0; for (int i = QUALIFIER_BYTES - 1; i >= 0; i--) { packed[i] = (byte) ((offset >> shift) & 0xFF); shift += 8; } return packed; } }
<reponame>singnet/snet-monitoring<filename>metering/handlers/verify_handler.py import json from constants import StatusCode from utils import make_response def main(event, context): return make_response( status_code=StatusCode.SUCCESS_GET_CODE, body=json.dumps({"data": "success"}) )
/***************************************************************************** * Licensed to Qualys, Inc. (QUALYS) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * QUALYS licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. ****************************************************************************/ /** * @file * @brief IronBee --- Init Collection Module * * This module provides the InitCollection directive. * * @author <NAME> <<EMAIL>> */ #include "ironbee_config_auto.h" #include "persistence_framework.h" #include <ironbee/context.h> #include <ironbee/engine.h> #include <ironbee/engine_state.h> #include <ironbee/file.h> #if ENABLE_JSON #include <ironbee/json.h> #endif #include <ironbee/module.h> #include <ironbee/path.h> #include <ironbee/rule_engine.h> #include <ironbee/string.h> #include <ironbee/transformation.h> #include <ironbee/uuid.h> #include <assert.h> #include <errno.h> #include <fcntl.h> #include <string.h> #include <unistd.h> #include <sys/stat.h> #include <sys/types.h> /* Module boilerplate */ #define MODULE_NAME init_collection #define MODULE_NAME_STR IB_XSTRINGIFY(MODULE_NAME) IB_MODULE_DECLARE(); /* JSON handlers are registered under this type. */ #define JSON_TYPE "json" /* JSON URI Prefix. */ #define JSON_URI_PREFIX "json-file://" /* VAR handlers are registered under this type. */ #define VAR_TYPE "var" /** * Module configuration. */ struct init_collection_cfg_t { ib_persist_fw_t *persist_fw; /**< Handle to the persistence framework. */ /** * The current configuration value. * * This pointer is a value-passing field and is changed often * during configuration time. It is used by the JSON * support code to find JSON files relative to the current * configuration file. This field is idle at runtime. */ const char *config_file; }; typedef struct init_collection_cfg_t init_collection_cfg_t; /* All JSON-related static functions and types are located here. * Do not move JSON code outside of the #if or builds disabling * JSON will probably fail. */ #if ENABLE_JSON /** * JSON configuration type. */ struct json_t { const char *file; /**< The file containing the JSON. */ }; typedef struct json_t json_t; /** * JSON Load callback. * * @param[in] impl The implementation created by json_create_fn(). * @param[in] tx The transaction. * @param[in] key Unused. * @param[in] key_len Unused. * @param[in] fields The output fields. * @param[in] cbdata Callback data. Unused. * * @returns * - IB_OK On success. * - Other on failure. */ static ib_status_t json_load_fn( void *impl, ib_tx_t *tx, const char *key, size_t key_len, ib_list_t *fields, void *cbdata ) { assert(impl != NULL); assert(tx != NULL); assert(fields != NULL); json_t *json_cfg = (json_t *)impl; ib_status_t rc; const char *err_msg; const uint8_t *buf = NULL; size_t sz; /* Load the file into a buffer. */ rc = ib_file_readall(tx->mm, json_cfg->file, &buf, &sz); if (rc != IB_OK) { if (rc == IB_EOTHER || rc == IB_EINVAL) { ib_log_error_tx( tx, "Error reading file \"%s\": %s", json_cfg->file, strerror(errno)); } else { ib_log_error_tx(tx, "Failed to read JSON file \"%s\"", json_cfg->file); } return rc; } /* Parse the buffer into the fields list. */ rc = ib_json_decode_ex(tx->mm, buf, sz, fields, &err_msg); if (rc != IB_OK) { ib_log_error_tx( tx, "Error decoding JSON file \"%s\": %s", json_cfg->file, err_msg); return rc; } return IB_OK; } /** * Create a new @a impl which is passed to json_load_fn(). * * @param[in] ib IronBee Engine. * @param[in] params Parameters to constructor. * @param[out] impl The @ref json_t to be constructed. * @param[in] cbdata Callback data. An @ref init_collection_cfg_t. * * @returns * - IB_OK On success. * - IB_EINVAL On invalid entry. * - IB_EALLOC On allocation error. */ static ib_status_t json_create_fn( ib_engine_t *ib, const ib_list_t *params, void *impl, void *cbdata ) { assert(ib != NULL); assert(params != NULL); assert(impl != NULL); assert(cbdata != NULL); ib_mm_t mm = ib_engine_mm_main_get(ib); json_t *json_cfg; const ib_list_node_t *node; const char *json_file; init_collection_cfg_t *cfg = (init_collection_cfg_t *)cbdata; assert(cfg->config_file != NULL); json_cfg = ib_mm_alloc(mm, sizeof(*json_cfg)); if (json_cfg == NULL) { return IB_EALLOC; } /* Get the collection node. We don't care about this. Skip it. */ node = ib_list_first_const(params); if (node == NULL) { ib_log_error(ib, "JSON requires at least 2 arguments: name and uri."); return IB_EINVAL; } /* Get the URI to the file. */ node = ib_list_node_next_const(node); if (node == NULL) { ib_log_error(ib, "JSON requires at least 2 arguments: name and uri."); return IB_EINVAL; } json_file = (const char *)ib_list_node_data_const(node); if (strstr(json_file, JSON_URI_PREFIX) == NULL) { ib_log_error(ib, "JSON URI Malformed: %s", json_file); return IB_EINVAL; } /* Move the character pointer past the prefix so only the file remains. */ json_file += (sizeof(JSON_URI_PREFIX)-1); json_cfg->file = ib_util_relative_file(mm, cfg->config_file, json_file); if (json_cfg->file == NULL) { return IB_EALLOC; } *(json_t **)impl = json_cfg; return IB_OK; } #endif /* ENABLE_JSON */ /** * Var implementation data. */ struct var_t { const ib_list_t *fields; /**< Fields to return. */ }; typedef struct var_t var_t; /** * Helper function to var_create_fn() that populates a list of fields. * * @param[in] ib IronBee engine. * @param[in] collection_name Collection name. Used for logging. * @param[in] mm Memory Manager for allocations. * @param[in] node The list node to start creating fields from. * @param[out] fields The list to populate. * * @returns * - IB_OK On success. * - IB_EALLOC On allocation errors. * - Other on transformation or parsing errors. */ static ib_status_t var_create_fields( ib_engine_t *ib, const char *collection_name, ib_mm_t mm, const ib_list_node_t *node, ib_list_t *fields ) { /* For the rest of the nodes... */ for ( ; node != NULL; node = ib_list_node_next_const(node)) { ib_status_t rc; const char *assignment = (const char *)ib_list_node_data_const(node); const char *eqsign = index(assignment, '='); const ib_field_t *field = NULL; ib_list_t *tfn_insts = NULL; /* Assume an empty assignment if no equal sign is included. */ if (eqsign == NULL) { ib_bytestr_t *bs = NULL; rc = ib_bytestr_dup_nulstr(&bs, mm, ""); if (rc != IB_OK) { ib_log_error(ib, "Failed to create byte string."); return rc; } /* The whole assignment is just a variable name. */ rc = ib_field_create( (ib_field_t **)&field, mm, assignment, strlen(assignment), IB_FTYPE_BYTESTR, ib_ftype_bytestr_in(bs)); } else if (*(eqsign + 1) == '\0') { ib_bytestr_t *bs = NULL; rc = ib_bytestr_dup_nulstr(&bs, mm, ""); if (rc != IB_OK) { ib_log_error(ib, "Failed to create byte string."); return rc; } /* The assignment is a var name + '='. */ rc = ib_field_create( (ib_field_t **)&field, mm, assignment, strlen(assignment) - 1, /* -1 drops the '=' from the name. */ IB_FTYPE_BYTESTR, ib_ftype_bytestr_in(bs)); } else { const char *value; ib_list_t *tfn_fields = NULL; rc = ib_list_create(&tfn_fields, mm); if (rc != IB_OK) { ib_log_error(ib, "Failed to create transformation list."); return rc; } rc = ib_cfg_parse_target_string(mm, eqsign+1, &value, tfn_fields); if (rc != IB_OK) { ib_log_error(ib, "Failed to parse target value."); } rc = ib_list_create(&tfn_insts, mm); if (rc != IB_OK) { ib_log_error(ib, "Failed to create transformation list."); return rc; } rc = ib_rule_tfn_fields_to_inst(ib, mm, tfn_fields, tfn_insts); if (rc != IB_OK) { ib_log_error(ib, "Failed to build transformations."); return rc; } /* Make sure value is a copy, not the original string. */ if (value == eqsign+1) { value = ib_mm_strdup(mm, value); if (value == NULL) { return IB_EALLOC; } } /* Normal assignment. eqsign is the end of the name. * eqsign + 1 is the start of the assigned value. */ ib_field_create_bytestr_alias( (ib_field_t **)&field, mm, assignment, eqsign - assignment, (const uint8_t *)IB_S2SL(value)); } /* Check the field creation in the above if-then-else. */ if (rc != IB_OK) { ib_log_error( ib, "Failed to create field for assignment %s", assignment); return IB_EALLOC; } /* Make sure we didn't somehow forget to set the field. */ assert(field != NULL); /* Apply transformations to the field. */ if (tfn_insts != NULL) { const ib_list_node_t *tfn_node; IB_LIST_LOOP_CONST(tfn_insts, tfn_node) { const ib_field_t *tmp_field; const ib_transformation_inst_t *tfn_inst = (const ib_transformation_inst_t *)ib_list_node_data_const(tfn_node); rc = ib_transformation_inst_execute(tfn_inst, mm, field, &tmp_field); if (rc != IB_OK) { ib_log_error( ib, "Failed to run transformation %s for InitCollection. " "Not initializing %s in %s: %s", ib_transformation_name(ib_transformation_inst_transformation(tfn_inst)), field->name, collection_name, ib_status_to_string(rc)); /* As above, failure should not kill the whole config. */ return IB_OK; } /* Promote the temporary field to the new current field. */ field = tmp_field; } } rc = ib_list_push(fields, (void *)field); if (rc != IB_OK) { ib_log_error(ib, "Failed to push field onto field list."); return rc; } } return IB_OK; } /** * Create vars. Calls var_create_fields() to do much of the work. * * @param[in] ib IronBee engine. * @param[in] params Parameters. * @param[out] impl A new @ref var_t to be constructed. * @param[in] cbdata Callback data. Unused. * * @returns * - IB_OK On success. * - IB_EINVAL On an invalid input from the config file. * - IB_EALLOC On allocation errors. * - Other on sub call errors. */ static ib_status_t var_create_fn( ib_engine_t *ib, const ib_list_t *params, void *impl, void *cbdata ) { assert(ib != NULL); assert(params != NULL); assert(impl != NULL); assert(cbdata == NULL); ib_mm_t mm = ib_engine_mm_main_get(ib); var_t *var; ib_list_t *fields; const ib_list_node_t *node; ib_status_t rc; const char *collection_name; /* Used in logging. */ var = ib_mm_alloc(mm, sizeof(*var)); if (var == NULL) { return IB_EALLOC; } rc = ib_list_create(&fields, mm); if (rc != IB_OK) { ib_log_error(ib, "Failed to create field list."); return rc; } /* The collection name. We will skip this. */ node = ib_list_first_const(params); if (node == NULL) { ib_log_error(ib, "VAR requires at least 2 arguments: name and uri."); return IB_EINVAL; } collection_name = (const char *)ib_list_node_data_const(node); /* The URI. We will skip this. */ node = ib_list_node_next_const(node); /* If there is no URI, this is an empty collection. */ if (node != NULL) { /* Skip the URI parameter. */ node = ib_list_node_next_const(node); /* Build fields. */ rc = var_create_fields(ib, collection_name, mm, node, fields); if (rc != IB_OK) { return rc; } } var->fields = fields; *(var_t **)impl = var; return IB_OK; } /** * Load fields created by var_create_fn(). * * @param[in] impl The @ref var_t created by var_create_fn(). * @param[in] tx The current transaction. * @param[in] key Unused. * @param[in] key_len Unused. * @param[in] fields The output fields. * @param[in] cbdata Callback data. Unused. * * @return * - IB_OK On success. * - IB_EOTHER On unexpected list manipulation errors. */ static ib_status_t var_load_fn( void *impl, ib_tx_t *tx, const char *key, size_t key_len, ib_list_t *fields, void *cbdata ) { assert(impl != NULL); assert(tx != NULL); var_t *var = (var_t *)impl; const ib_list_node_t *node; assert(var->fields != NULL); IB_LIST_LOOP_CONST(var->fields, node) { ib_status_t rc; const ib_field_t *field = (const ib_field_t *)ib_list_node_data_const(node); assert(field != NULL); rc = ib_list_push(fields, (void *)field); if (rc != IB_OK) { ib_log_error_tx(tx, "Failed to populate fields."); return rc; } } return IB_OK; } /** * Instantiate an instance of @a type and map @a collection_name with it. * * This function requests that the persistence framework create * a new named store using a random UUID as the name can calling * ib_persist_fw_create_store(). That collection named @a collection_name * is then mapped to that store, meaning that it will be populated * and persisted in the course of a transaction. * * @param[in] cp The configuration parser. * @param[in] ctx The configuration context. * @param[in] type The type being mapped. * @param[in] cfg The configuration used in this module. * @param[in] collection_name The name of the collection. * @param[in] params List of parameters. * The first element is the name of the collection. * The second element is the URI. * The rest are options. * @returns * - IB_OK On success. * - Other on failure of ib_uuid_create_v4_from_mp() or @c ib_persist_fw_* calls. */ static ib_status_t domap( ib_cfgparser_t *cp, ib_context_t *ctx, const char *type, init_collection_cfg_t *cfg, const char *collection_name, const ib_list_t *params ) { char store_name[37]; ib_status_t rc; rc = ib_uuid_create_v4(store_name); if (rc != IB_OK) { ib_cfg_log_error(cp, "Failed to create UUIDv4 store."); return rc; } rc = ib_persist_fw_create_store( cfg->persist_fw, ctx, type, store_name, params); if (rc != IB_OK) { ib_cfg_log_error(cp, "Failed to create store %s", store_name); return rc; } rc = ib_persist_fw_map_collection( cfg->persist_fw, ctx, collection_name, IB_S2SL("no key"), 0, /* No expiration. */ store_name); if (rc != IB_OK) { ib_cfg_log_error( cp, "Failed to map store %s to collection %s.", store_name, collection_name); return rc; } return IB_OK; } /** * Implement the InitCollection directive. * * @param[in] cp Configuration parser. * @param[in] directive InitCollection. * @param[in] vars List of `char *` types making up the parameters. * @param[in] cfg The module configuration. * * @returns * - IB_OK On success. * - IB_EINVAL If an error in the configuration parameters is detected. * - IB_EALLOC On memory allocation errors. * - Other when interacting with IronBee API. */ static ib_status_t init_collection_common( ib_cfgparser_t *cp, const char *directive, const ib_list_t *vars, init_collection_cfg_t *cfg ) { assert(cp != NULL); assert(directive != NULL); assert(vars != NULL); assert(cfg != NULL); assert(cfg->persist_fw != NULL); ib_status_t rc; const ib_list_node_t *node; const char *name; /* The name of the collection. */ const char *uri; /* The URI to the resource. */ ib_context_t *ctx; ib_cfg_log_debug(cp, "Initializing collection."); /* Set the configuration file before doing much else. */ cfg->config_file = ib_cfgparser_curr_file(cp); rc = ib_cfgparser_context_current(cp, &ctx); if (rc != IB_OK) { ib_cfg_log_error(cp, "Failed to retrieve current config context."); goto exit_rc; } /* Get the collection name string */ node = ib_list_first_const(vars); if (node == NULL) { ib_cfg_log_error(cp, "%s: No collection name specified", directive); goto exit_EINVAL; } name = (const char *)ib_list_node_data_const(node); if (name == NULL) { ib_cfg_log_error(cp, "Name parameter unexpectedly NULL."); goto exit_EINVAL; } /* Get the collection uri. */ node = ib_list_node_next_const(node); /* If there is only the single element (name) then create an empty col. */ if (node == NULL) { rc = domap(cp, ctx, VAR_TYPE, cfg, name, vars); goto exit_rc; } /* Otherwise, the second value is the URI. */ uri = (const char *)ib_list_node_data_const(node); if (uri == NULL) { ib_cfg_log_error(cp, "URI parameter unexpectedly NULL."); goto exit_EINVAL; } if (strncmp(uri, "vars:", sizeof("vars:")) == 0) { rc = domap(cp, ctx, VAR_TYPE, cfg, name, vars); if (rc != IB_OK) { goto exit_rc; } } #if ENABLE_JSON else if (strncmp(uri, JSON_URI_PREFIX, sizeof(JSON_URI_PREFIX)-3) == 0) { rc = domap(cp, ctx, JSON_TYPE, cfg, name, vars); if (rc != IB_OK) { goto exit_rc; } } #endif else { ib_cfg_log_error(cp, "URI \"%s\" not supported for persistence.", uri); goto exit_EINVAL; } rc = ib_var_source_register( NULL, ib_engine_var_config_get(cp->ib), IB_S2SL(name), IB_PHASE_NONE, IB_PHASE_NONE ); if (rc != IB_EEXIST && rc != IB_OK) { ib_cfg_log_error( cp, "Failed to register collection %s: %s", name, ib_status_to_string(rc)); goto exit_rc; } /* Clear the configuration file to expose errors. */ cfg->config_file = NULL; return IB_OK; exit_rc: cfg->config_file = NULL; return rc; exit_EINVAL: cfg->config_file = NULL; return IB_EINVAL; } /** * Implement the IndexCollection directive. * * param[in] cp The configuration parser. * param[in] directive InitCollection. * param[in] vars Argument list to the directive. * param[in] cbdata An @ref init_collection_cfg_t. * * @returns results of init_collection_common(); */ static ib_status_t init_collection_fn( ib_cfgparser_t *cp, const char *directive, const ib_list_t *vars, void *cbdata ) { return init_collection_common( cp, directive, vars, (init_collection_cfg_t *)cbdata ); } /** * Register directives so as to define a callback data struct. * * @param[in] ib IronBee engine. * @param[in] cfg The module configuration. * * @returns * - IB_OK On Success. * - Other on failure of ib_config_register_directives(). */ static ib_status_t register_directives( ib_engine_t *ib, init_collection_cfg_t *cfg) { assert(ib != NULL); assert(cfg != NULL); ib_status_t rc; rc = ib_config_register_directive( ib, "InitCollection", IB_DIRTYPE_LIST, (ib_void_fn_t)init_collection_fn, NULL, cfg, NULL, NULL ); if (rc != IB_OK) { return rc; } return IB_OK; } /** * Module init. * * @param[in] ib IronBee engine. * @param[in] module Module structure. * @param[in] cbdata Callback data. * * @returns * - IB_OK On success. */ static ib_status_t init_collection_init( ib_engine_t *ib, ib_module_t *module, void *cbdata ) { assert(ib != NULL); assert(module != NULL); ib_status_t rc; ib_mm_t mm = ib_engine_mm_main_get(ib); init_collection_cfg_t *cfg; cfg = ib_mm_alloc(mm, sizeof(*cfg)); if (cfg == NULL) { return IB_EALLOC; } cfg->persist_fw = NULL; rc = ib_persist_fw_create(ib, module, &(cfg->persist_fw)); if (rc != IB_OK) { ib_log_error( ib, "Failed to register module " MODULE_NAME_STR " with persistence module."); return rc; } rc = register_directives(ib, cfg); if (rc != IB_OK) { ib_log_error(ib, "Failed to register directives."); return rc; } rc = ib_persist_fw_register_type( cfg->persist_fw, ib_context_main(ib), VAR_TYPE, var_create_fn, /* Create. */ NULL, NULL, /* Destroy. */ NULL, var_load_fn, /* Load. */ NULL, NULL, /* Store. */ NULL); if (rc != IB_OK) { ib_log_error(ib, "Failed to register var type."); return rc; } #if ENABLE_JSON rc = ib_persist_fw_register_type( cfg->persist_fw, ib_context_main(ib), JSON_TYPE, json_create_fn, /* Create. */ cfg, NULL, /* Destroy. */ NULL, json_load_fn, /* Load. */ NULL, NULL, /* Store. */ NULL); if (rc != IB_OK) { ib_log_error(ib, "Failed to register json type."); return rc; } #endif return IB_OK; } IB_MODULE_INIT( IB_MODULE_HEADER_DEFAULTS, /* Header defaults. */ MODULE_NAME_STR, /* Module name. */ IB_MODULE_CONFIG_NULL, /* NULL Configuration: NULL, 0, NULL, NULL */ NULL, /* Config map. */ NULL, /* Directive map. Dynamically built. */ init_collection_init, /* Initialization. */ NULL, /* Callback data. */ NULL, /* Finalization. */ NULL, /* Callback data. */ );
<filename>src/main/java/com/infinities/skyport/service/WebsockifyService.java /******************************************************************************* * Copyright 2015 InfinitiesSoft Solutions Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. You may obtain * a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. *******************************************************************************/ package com.infinities.skyport.service; import java.io.Closeable; import java.io.Serializable; import com.infinities.skyport.model.console.WebsockifyProfile; import com.infinities.skyport.websockify.WebsockifyServer; public interface WebsockifyService extends Closeable, Serializable { void initialize() throws Exception; public WebsockifyProfile sockify(WebsockifyProfile profile) throws Exception; public WebsockifyProfile release(WebsockifyProfile profile) throws Exception; public void setSecurityManager(Object securityManager); public void setWebsockifyServer(WebsockifyServer websockifyServer); }
# Copyright (c) 2007-2013 Alysson Bessani, Eduardo Alchieri, Paulo Sousa, and the authors indicated in the @author tags # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. #/bin/bash export MESSAGE_BATCH=1000 java -javaagent:./bin/agent.jar -Dmessage_batch=$MESSAGE_BATCH -cp ./lib/*:./bin/ com.yahoo.ycsb.Client -threads 10 -P config/workloads/workloada -p measurementtype=timeseries -p timeseries.granularity=1000 -db bftsmart.demo.ycsb.YCSBClient -s > output.txt
package math; import java.io.BufferedReader; import java.io.InputStreamReader; public class Boj1094 { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb = new StringBuilder(); int X = Integer.parseInt(br.readLine()); int cnt = 0; double log = Math.log(X) / Math.log(2); if (log * log == X || X == 1) { cnt = 1; sb.append(cnt); } else { RESULT: for (;;) { int res = 1, Max = 0; LOOP: while (true) { res *= 2; if (res <= X) { Max = Math.max(Max, res); } else { break LOOP; } } cnt++; X -= Max; if(X == 1){ cnt++; break RESULT; } else if(X==0){ break RESULT; } } sb.append(cnt); } System.out.println(sb.toString()); } }
<gh_stars>100-1000 import AppDispatcher from "../dispatcher/AppDispatcher"; import LeftColumnConstants from "../constants/LeftColumnConstants.js"; var LeftColumnActions = { toggle: function() { AppDispatcher.handleViewAction({ actionType: LeftColumnConstants.TOGGLE_LEFTCOLUMN, }); }, }; export default LeftColumnActions;
#!/usr/bin/env bash # Taken from ~/.osx in Mathias Bynens' dotfiles — https://mths.be/osx # OSX-only stuff. Abort if not OSX. [[ "$OSTYPE" =~ ^darwin ]] || return 1 # Ask for the administrator password upfront sudo -v # Keep-alive: update existing `sudo` time stamp until `.osx` has finished while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null & ############################################################################### # General UI/UX # ############################################################################### # Set computer name (as done via System Preferences → Sharing) #sudo scutil --set ComputerName "0x6D746873" #sudo scutil --set HostName "0x6D746873" #sudo scutil --set LocalHostName "0x6D746873" #sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName -string "0x6D746873" # Set standby delay to 24 hours (default is 1 hour) sudo pmset -a standbydelay 86400 # Disable the sound effects on boot #sudo nvram SystemAudioVolume=" " # Menu bar: disable transparency defaults write NSGlobalDomain AppleEnableMenuBarTransparency -bool false # Menu bar: hide the Time Machine, Volume, User, and Bluetooth icons for domain in ~/Library/Preferences/ByHost/com.apple.systemuiserver.*; do defaults write "${domain}" dontAutoLoad -array \ "/System/Library/CoreServices/Menu Extras/TimeMachine.menu" \ "/System/Library/CoreServices/Menu Extras/Volume.menu" \ "/System/Library/CoreServices/Menu Extras/User.menu" done defaults write com.apple.systemuiserver menuExtras -array \ "/System/Library/CoreServices/Menu Extras/Bluetooth.menu" \ "/System/Library/CoreServices/Menu Extras/AirPort.menu" \ "/System/Library/CoreServices/Menu Extras/Battery.menu" \ "/System/Library/CoreServices/Menu Extras/Clock.menu" # Set highlight color to green defaults write NSGlobalDomain AppleHighlightColor -string "0.764700 0.976500 0.568600" # Set sidebar icon size to medium defaults write NSGlobalDomain NSTableViewDefaultSizeMode -int 2 # Always show scrollbars defaults write NSGlobalDomain AppleShowScrollBars -string "Always" # Possible values: `WhenScrolling`, `Automatic` and `Always` # Disable smooth scrolling # (Uncomment if you’re on an older Mac that messes up the animation) #defaults write NSGlobalDomain NSScrollAnimationEnabled -bool false # Increase window resize speed for Cocoa applications defaults write NSGlobalDomain NSWindowResizeTime -float 0.001 # Expand save panel by default defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode2 -bool true # Expand print panel by default defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true defaults write NSGlobalDomain PMPrintingExpandedStateForPrint2 -bool true # Save to disk (not to iCloud) by default defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false # Automatically quit printer app once the print jobs complete defaults write com.apple.print.PrintingPrefs "Quit When Finished" -bool true # Disable the “Are you sure you want to open this application?” dialog defaults write com.apple.LaunchServices LSQuarantine -bool false # Remove duplicates in the “Open With” menu (also see `lscleanup` alias) /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user # Display ASCII control characters using caret notation in standard text views # Try e.g. `cd /tmp; unidecode "\x{0000}" > cc.txt; open -e cc.txt` defaults write NSGlobalDomain NSTextShowsControlCharacters -bool true # Disable Resume system-wide defaults write NSGlobalDomain NSQuitAlwaysKeepsWindows -bool false # Disable automatic termination of inactive apps defaults write NSGlobalDomain NSDisableAutomaticTermination -bool true # Disable the crash reporter #defaults write com.apple.CrashReporter DialogType -string "none" # Set Help Viewer windows to non-floating mode defaults write com.apple.helpviewer DevMode -bool true # Fix for the ancient UTF-8 bug in QuickLook (https://mths.be/bbo) # Commented out, as this is known to cause problems in various Adobe apps :( # See https://github.com/mathiasbynens/dotfiles/issues/237 #echo "0x08000100:0" > ~/.CFUserTextEncoding # Reveal IP address, hostname, OS version, etc. when clicking the clock # in the login window sudo defaults write /Library/Preferences/com.apple.loginwindow AdminHostInfo HostName # Restart automatically if the computer freezes sudo systemsetup -setrestartfreeze on # Never go into computer sleep mode #sudo systemsetup -setcomputersleep Off > /dev/null # Check for software updates daily, not just once per week defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1 # Disable Notification Center and remove the menu bar icon launchctl unload -w /System/Library/LaunchAgents/com.apple.notificationcenterui.plist 2> /dev/null # Disable smart quotes as they’re annoying when typing code defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false # Disable smart dashes as they’re annoying when typing code defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false # Set a custom wallpaper image. `DefaultDesktop.jpg` is already a symlink, and # all wallpapers are in `/Library/Desktop Pictures/`. The default is `Wave.jpg`. #rm -rf ~/Library/Application Support/Dock/desktoppicture.db #sudo rm -rf /System/Library/CoreServices/DefaultDesktop.jpg #sudo ln -s /path/to/your/image /System/Library/CoreServices/DefaultDesktop.jpg ############################################################################### # SSD-specific tweaks # ############################################################################### # Disable local Time Machine snapshots sudo tmutil disablelocal # Disable hibernation (speeds up entering sleep mode) sudo pmset -a hibernatemode 0 # Remove the sleep image file to save disk space sudo rm /Private/var/vm/sleepimage # Create a zero-byte file instead… sudo touch /Private/var/vm/sleepimage # …and make sure it can’t be rewritten sudo chflags uchg /Private/var/vm/sleepimage # Disable the sudden motion sensor as it’s not useful for SSDs sudo pmset -a sms 0 ############################################################################### # Trackpad, mouse, keyboard, Bluetooth accessories, and input # ############################################################################### # Trackpad: enable tap to click for this user and for the login screen defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1 defaults write NSGlobalDomain com.apple.mouse.tapBehavior -int 1 # Trackpad: map bottom right corner to right-click #defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadCornerSecondaryClick -int 2 #defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadRightClick -bool true #defaults -currentHost write NSGlobalDomain com.apple.trackpad.trackpadCornerClickBehavior -int 1 #defaults -currentHost write NSGlobalDomain com.apple.trackpad.enableSecondaryClick -bool true # Disable “natural” (Lion-style) scrolling #defaults write NSGlobalDomain com.apple.swipescrolldirection -bool false # Increase sound quality for Bluetooth headphones/headsets #defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" -int 40 # Enable full keyboard access for all controls # (e.g. enable Tab in modal dialogs) defaults write NSGlobalDomain AppleKeyboardUIMode -int 3 # Use scroll gesture with the Ctrl (^) modifier key to zoom defaults write com.apple.universalaccess closeViewScrollWheelToggle -bool true defaults write com.apple.universalaccess HIDScrollZoomModifierMask -int 262144 # Follow the keyboard focus while zoomed in defaults write com.apple.universalaccess closeViewZoomFollowsFocus -bool true # Disable press-and-hold for keys in favor of key repeat defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false # Set a blazingly fast keyboard repeat rate defaults write NSGlobalDomain KeyRepeat -int 0 # Set language and text formats # Note: if you’re in the US, replace `EUR` with `USD`, `Centimeters` with # `Inches`, `en_GB` with `en_US`, and `true` with `false`. #defaults write NSGlobalDomain AppleLanguages -array "en" "nl" defaults write NSGlobalDomain AppleLocale -string "en_US@currency=USD" defaults write NSGlobalDomain AppleMeasurementUnits -string "Centimeters" defaults write NSGlobalDomain AppleMetricUnits -bool true # Set the timezone; see `sudo systemsetup -listtimezones` for other values sudo systemsetup -settimezone "America/New_York" > /dev/null # Disable auto-correct defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false # Stop iTunes from responding to the keyboard media keys #launchctl unload -w /System/Library/LaunchAgents/com.apple.rcd.plist 2> /dev/null ############################################################################### # Screen # ############################################################################### # Require password immediately after sleep or screen saver begins defaults write com.apple.screensaver askForPassword -int 1 defaults write com.apple.screensaver askForPasswordDelay -int 0 # Save screenshots to the desktop defaults write com.apple.screencapture location -string "${HOME}/Pictures/screenshots" # Save screenshots in PNG format (other options: BMP, GIF, JPG, PDF, TIFF) defaults write com.apple.screencapture type -string "png" # Disable shadow in screenshots defaults write com.apple.screencapture disable-shadow -bool true # Enable subpixel font rendering on non-Apple LCDs defaults write NSGlobalDomain AppleFontSmoothing -int 2 # Enable HiDPI display modes (requires restart) sudo defaults write /Library/Preferences/com.apple.windowserver DisplayResolutionEnabled -bool true ############################################################################### # Finder # ############################################################################### # Finder: allow quitting via ⌘ + Q; doing so will also hide desktop icons #defaults write com.apple.finder QuitMenuItem -bool true # Finder: disable window animations and Get Info animations defaults write com.apple.finder DisableAllAnimations -bool true # Set Desktop as the default location for new Finder windows # For other paths, use `PfLo` and `file:///full/path/here/` defaults write com.apple.finder NewWindowTarget -string "PfLo" defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}/" # Show icons for hard drives, servers, and removable media on the desktop defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool true defaults write com.apple.finder ShowHardDrivesOnDesktop -bool true defaults write com.apple.finder ShowMountedServersOnDesktop -bool true defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool true # Finder: show hidden files by default #defaults write com.apple.finder AppleShowAllFiles -bool true # Finder: show all filename extensions defaults write NSGlobalDomain AppleShowAllExtensions -bool true # Finder: show status bar defaults write com.apple.finder ShowStatusBar -bool true # Finder: show path bar defaults write com.apple.finder ShowPathbar -bool true # Finder: allow text selection in Quick Look defaults write com.apple.finder QLEnableTextSelection -bool true # Display full POSIX path as Finder window title defaults write com.apple.finder _FXShowPosixPathInTitle -bool true # When performing a search, search the current folder by default defaults write com.apple.finder FXDefaultSearchScope -string "SCcf" # Disable the warning when changing a file extension defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false # Enable spring loading for directories defaults write NSGlobalDomain com.apple.springing.enabled -bool true # Remove the spring loading delay for directories defaults write NSGlobalDomain com.apple.springing.delay -float 0 # Avoid creating .DS_Store files on network volumes defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true # Disable disk image verification defaults write com.apple.frameworks.diskimages skip-verify -bool true defaults write com.apple.frameworks.diskimages skip-verify-locked -bool true defaults write com.apple.frameworks.diskimages skip-verify-remote -bool true # Automatically open a new Finder window when a volume is mounted defaults write com.apple.frameworks.diskimages auto-open-ro-root -bool true defaults write com.apple.frameworks.diskimages auto-open-rw-root -bool true defaults write com.apple.finder OpenWindowForNewRemovableDisk -bool true # Show item info near icons on the desktop and in other icon views /usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist /usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist /usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist # Show item info to the right of the icons on the desktop /usr/libexec/PlistBuddy -c "Set DesktopViewSettings:IconViewSettings:labelOnBottom false" ~/Library/Preferences/com.apple.finder.plist # Enable snap-to-grid for icons on the desktop and in other icon views /usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist /usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist /usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist # Increase grid spacing for icons on the desktop and in other icon views /usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:gridSpacing 100" ~/Library/Preferences/com.apple.finder.plist /usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:gridSpacing 100" ~/Library/Preferences/com.apple.finder.plist /usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:gridSpacing 100" ~/Library/Preferences/com.apple.finder.plist # Increase the size of icons on the desktop and in other icon views /usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:iconSize 80" ~/Library/Preferences/com.apple.finder.plist /usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:iconSize 80" ~/Library/Preferences/com.apple.finder.plist /usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:iconSize 80" ~/Library/Preferences/com.apple.finder.plist # Use list view in all Finder windows by default # Four-letter codes for the other view modes: `icnv`, `clmv`, `Flwv` defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv" # Disable the warning before emptying the Trash defaults write com.apple.finder WarnOnEmptyTrash -bool false # Empty Trash securely by default defaults write com.apple.finder EmptyTrashSecurely -bool true # Enable AirDrop over Ethernet and on unsupported Macs running Lion #defaults write com.apple.NetworkBrowser BrowseAllInterfaces -bool true # Enable the MacBook Air SuperDrive on any Mac #sudo nvram boot-args="mbasd=1" # Show the ~/Library folder chflags nohidden ~/Library # Remove Dropbox’s green checkmark icons in Finder #file=/Applications/Dropbox.app/Contents/Resources/emblem-dropbox-uptodate.icns #[ -e "${file}" ] && mv -f "${file}" "${file}.bak" # Expand the following File Info panes: # “General”, “Open with”, and “Sharing & Permissions” defaults write com.apple.finder FXInfoPanesExpanded -dict \ General -bool true \ OpenWith -bool true \ Privileges -bool true ############################################################################### # Dock, Dashboard, and hot corners # ############################################################################### # Enable highlight hover effect for the grid view of a stack (Dock) defaults write com.apple.dock mouse-over-hilite-stack -bool true # Set the icon size of Dock items to 36 pixels defaults write com.apple.dock tilesize -int 36 # Change minimize/maximize window effect defaults write com.apple.dock mineffect -string "scale" # Minimize windows into their application’s icon defaults write com.apple.dock minimize-to-application -bool true # Enable spring loading for all Dock items defaults write com.apple.dock enable-spring-load-actions-on-all-items -bool true # Show indicator lights for open applications in the Dock defaults write com.apple.dock show-process-indicators -bool true # Wipe all (default) app icons from the Dock # This is only really useful when setting up a new Mac, or if you don’t use # the Dock to launch apps. defaults write com.apple.dock persistent-apps -array "" # Don’t animate opening applications from the Dock defaults write com.apple.dock launchanim -bool false # Speed up Mission Control animations defaults write com.apple.dock expose-animation-duration -float 0.1 # Don’t group windows by application in Mission Control # (i.e. use the old Exposé behavior instead) defaults write com.apple.dock expose-group-by-app -bool false # Disable Dashboard defaults write com.apple.dashboard mcx-disabled -bool true # Don’t show Dashboard as a Space defaults write com.apple.dock dashboard-in-overlay -bool true # Don’t automatically rearrange Spaces based on most recent use defaults write com.apple.dock mru-spaces -bool false # Remove the auto-hiding Dock delay defaults write com.apple.dock autohide-delay -float 0 # Remove the animation when hiding/showing the Dock defaults write com.apple.dock autohide-time-modifier -float 0 # Enable the 2D Dock #defaults write com.apple.dock no-glass -bool true # Automatically hide and show the Dock defaults write com.apple.dock autohide -bool true # Make Dock icons of hidden applications translucent defaults write com.apple.dock showhidden -bool true # Make Dock more transparent defaults write com.apple.dock hide-mirror -bool true # Disable the Launchpad gesture (pinch with thumb and three fingers) defaults write com.apple.dock showLaunchpadGestureEnabled -int 0 # Reset Launchpad, but keep the desktop wallpaper intact find "${HOME}/Library/Application Support/Dock" -name "*-*.db" -maxdepth 1 -delete # Add iOS Simulator to Launchpad #sudo ln -sf "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone Simulator.app" "/Applications/iOS Simulator.app" # Add a spacer to the left side of the Dock (where the applications are) #defaults write com.apple.dock persistent-apps -array-add '{tile-data={}; tile-type="spacer-tile";}' # Add a spacer to the right side of the Dock (where the Trash is) #defaults write com.apple.dock persistent-others -array-add '{tile-data={}; tile-type="spacer-tile";}' # Hot corners # Possible values: # 0: no-op # 2: Mission Control # 3: Show application windows # 4: Desktop # 5: Start screen saver # 6: Disable screen saver # 7: Dashboard # 10: Put display to sleep # 11: Launchpad # 12: Notification Center # Top left screen corner → Mission Control #defaults write com.apple.dock wvous-tl-corner -int 2 #defaults write com.apple.dock wvous-tl-modifier -int 0 # Top right screen corner → Desktop #defaults write com.apple.dock wvous-tr-corner -int 4 #defaults write com.apple.dock wvous-tr-modifier -int 0 # Bottom left screen corner → Start screen saver #defaults write com.apple.dock wvous-bl-corner -int 5 #defaults write com.apple.dock wvous-bl-modifier -int 0 ############################################################################### # Safari & WebKit # ############################################################################### # Set Safari’s home page to `about:blank` for faster loading defaults write com.apple.Safari HomePage -string "about:blank" # Prevent Safari from opening ‘safe’ files automatically after downloading defaults write com.apple.Safari AutoOpenSafeDownloads -bool false # Allow hitting the Backspace key to go to the previous page in history defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2BackspaceKeyNavigationEnabled -bool true # Hide Safari’s bookmarks bar by default #defaults write com.apple.Safari ShowFavoritesBar -bool false # Hide Safari’s sidebar in Top Sites defaults write com.apple.Safari ShowSidebarInTopSites -bool false # Disable Safari’s thumbnail cache for History and Top Sites defaults write com.apple.Safari DebugSnapshotsUpdatePolicy -int 2 # Enable Safari’s debug menu defaults write com.apple.Safari IncludeInternalDebugMenu -bool true # Make Safari’s search banners default to Contains instead of Starts With defaults write com.apple.Safari FindOnPageMatchesWordStartsOnly -bool false # Remove useless icons from Safari’s bookmarks bar #defaults write com.apple.Safari ProxiesInBookmarksBar "()" # Enable the Develop menu and the Web Inspector in Safari defaults write com.apple.Safari IncludeDevelopMenu -bool true defaults write com.apple.Safari WebKitDeveloperExtrasEnabledPreferenceKey -bool true defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled -bool true # Add a context menu item for showing the Web Inspector in web views defaults write NSGlobalDomain WebKitDeveloperExtras -bool true ############################################################################### # Mail # ############################################################################### # Disable send and reply animations in Mail.app defaults write com.apple.mail DisableReplyAnimations -bool true defaults write com.apple.mail DisableSendAnimations -bool true # Copy email addresses as `foo@example.com` instead of `Foo Bar <foo@example.com>` in Mail.app defaults write com.apple.mail AddressesIncludeNameOnPasteboard -bool false # Add the keyboard shortcut ⌘ + Enter to send an email in Mail.app defaults write com.apple.mail NSUserKeyEquivalents -dict-add "Send" -string "@\\U21a9" # Display emails in threaded mode, sorted by date (oldest at the top) defaults write com.apple.mail DraftsViewerAttributes -dict-add "DisplayInThreadedMode" -string "yes" defaults write com.apple.mail DraftsViewerAttributes -dict-add "SortedDescending" -string "yes" defaults write com.apple.mail DraftsViewerAttributes -dict-add "SortOrder" -string "received-date" # Disable inline attachments (just show the icons) defaults write com.apple.mail DisableInlineAttachmentViewing -bool true # Disable automatic spell checking #defaults write com.apple.mail SpellCheckingBehavior -string "NoSpellCheckingEnabled" ############################################################################### # Spotlight # ############################################################################### # Hide Spotlight tray-icon (and subsequent helper) sudo chmod 600 /System/Library/CoreServices/Search.bundle/Contents/MacOS/Search # Disable Spotlight indexing for any volume that gets mounted and has not yet # been indexed before. # Use `sudo mdutil -i off "/Volumes/foo"` to stop indexing any volume. sudo defaults write /.Spotlight-V100/VolumeConfiguration Exclusions -array "/Volumes" # Change indexing order and disable some file types defaults write com.apple.spotlight orderedItems -array \ '{"enabled" = 1;"name" = "APPLICATIONS";}' \ '{"enabled" = 1;"name" = "SYSTEM_PREFS";}' \ '{"enabled" = 1;"name" = "DIRECTORIES";}' \ '{"enabled" = 1;"name" = "PDF";}' \ '{"enabled" = 1;"name" = "FONTS";}' \ '{"enabled" = 0;"name" = "DOCUMENTS";}' \ '{"enabled" = 0;"name" = "MESSAGES";}' \ '{"enabled" = 0;"name" = "CONTACT";}' \ '{"enabled" = 0;"name" = "EVENT_TODO";}' \ '{"enabled" = 0;"name" = "IMAGES";}' \ '{"enabled" = 0;"name" = "BOOKMARKS";}' \ '{"enabled" = 0;"name" = "MUSIC";}' \ '{"enabled" = 0;"name" = "MOVIES";}' \ '{"enabled" = 0;"name" = "PRESENTATIONS";}' \ '{"enabled" = 0;"name" = "SPREADSHEETS";}' \ '{"enabled" = 0;"name" = "SOURCE";}' # Load new settings before rebuilding the index killall mds > /dev/null 2>&1 # Make sure indexing is enabled for the main volume sudo mdutil -i on / > /dev/null # Rebuild the index from scratch sudo mdutil -E / > /dev/null ############################################################################### # Terminal & iTerm 2 # ############################################################################### # Only use UTF-8 in Terminal.app defaults write com.apple.terminal StringEncodings -array 4 # Use a modified version of the Solarized Dark theme by default in Terminal.app TERM_PROFILE='Solarized Dark xterm-256color'; CURRENT_PROFILE="$(defaults read com.apple.terminal 'Default Window Settings')"; if [ "${CURRENT_PROFILE}" != "${TERM_PROFILE}" ]; then open "${HOME}/init/${TERM_PROFILE}.terminal"; sleep 1; # Wait a bit to make sure the theme is loaded defaults write com.apple.terminal 'Default Window Settings' -string "${TERM_PROFILE}"; defaults write com.apple.terminal 'Startup Window Settings' -string "${TERM_PROFILE}"; fi; # Enable “focus follows mouse” for Terminal.app and all X11 apps # i.e. hover over a window and start typing in it without clicking first #defaults write com.apple.terminal FocusFollowsMouse -bool true #defaults write org.x.X11 wm_ffm -bool true # Install the Solarized Dark theme for iTerm open "${HOME}/init/Solarized Dark.itermcolors" # Don’t display the annoying prompt when quitting iTerm defaults write com.googlecode.iterm2 PromptOnQuit -bool false ############################################################################### # Time Machine # ############################################################################### # Prevent Time Machine from prompting to use new hard drives as backup volume defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true # Disable local Time Machine backups hash tmutil &> /dev/null && sudo tmutil disablelocal ############################################################################### # Activity Monitor # ############################################################################### # Show the main window when launching Activity Monitor defaults write com.apple.ActivityMonitor OpenMainWindow -bool true # Visualize CPU usage in the Activity Monitor Dock icon defaults write com.apple.ActivityMonitor IconType -int 5 # Show all processes in Activity Monitor defaults write com.apple.ActivityMonitor ShowCategory -int 0 # Sort Activity Monitor results by CPU usage defaults write com.apple.ActivityMonitor SortColumn -string "CPUUsage" defaults write com.apple.ActivityMonitor SortDirection -int 0 ############################################################################### # Address Book, Dashboard, iCal, TextEdit, and Disk Utility # ############################################################################### # Enable the debug menu in Address Book #defaults write com.apple.addressbook ABShowDebugMenu -bool true # Enable Dashboard dev mode (allows keeping widgets on the desktop) #defaults write com.apple.dashboard devmode -bool true # Enable the debug menu in iCal (pre-10.8) #defaults write com.apple.iCal IncludeDebugMenu -bool true # Use plain text mode for new TextEdit documents #defaults write com.apple.TextEdit RichText -int 0 # Open and save files as UTF-8 in TextEdit #defaults write com.apple.TextEdit PlainTextEncoding -int 4 #defaults write com.apple.TextEdit PlainTextEncodingForWrite -int 4 # Enable the debug menu in Disk Utility #defaults write com.apple.DiskUtility DUDebugMenuEnabled -bool true #defaults write com.apple.DiskUtility advanced-image-options -bool true ############################################################################### # Mac App Store # ############################################################################### # Enable the WebKit Developer Tools in the Mac App Store #defaults write com.apple.appstore WebKitDeveloperExtras -bool true # Enable Debug Menu in the Mac App Store #defaults write com.apple.appstore ShowDebugMenu -bool true ############################################################################### # Messages # ############################################################################### # Disable automatic emoji substitution (i.e. use plain text smileys) defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "automaticEmojiSubstitutionEnablediMessage" -bool false # Disable smart quotes as it’s annoying for messages that contain code defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "automaticQuoteSubstitutionEnabled" -bool false # Disable continuous spell checking defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "continuousSpellCheckingEnabled" -bool false ############################################################################### # Google Chrome & Google Chrome Canary # ############################################################################### # Allow installing user scripts via GitHub Gist or Userscripts.org defaults write com.google.Chrome ExtensionInstallSources -array "https://gist.githubusercontent.com/" "http://userscripts.org/*" defaults write com.google.Chrome.canary ExtensionInstallSources -array "https://gist.githubusercontent.com/" "http://userscripts.org/*" # Disable the all too sensitive backswipe #defaults write com.google.Chrome AppleEnableSwipeNavigateWithScrolls -bool false #defaults write com.google.Chrome.canary AppleEnableSwipeNavigateWithScrolls -bool false ############################################################################### # GPGMail 2 # ############################################################################### # Disable signing emails by default #defaults write ~/Library/Preferences/org.gpgtools.gpgmail SignNewEmailsByDefault -bool false ############################################################################### # SizeUp.app # ############################################################################### # Start SizeUp at login #defaults write com.irradiatedsoftware.SizeUp StartAtLogin -bool true # Don’t show the preferences window on next start #defaults write com.irradiatedsoftware.SizeUp ShowPrefsOnNextStart -bool false ############################################################################### # Sublime Text # ############################################################################### # Install Sublime Text settings cp -r init/Preferences.sublime-settings ~/Library/Application\ Support/Sublime\ Text*/Packages/User/Preferences.sublime-settings 2> /dev/null ############################################################################### # Transmission.app # ############################################################################### # Use `~/Documents/Torrents` to store incomplete downloads #defaults write org.m0k.transmission UseIncompleteDownloadFolder -bool true #defaults write org.m0k.transmission IncompleteDownloadFolder -string "${HOME}/Documents/Torrents" # Don’t prompt for confirmation before downloading #defaults write org.m0k.transmission DownloadAsk -bool false # Trash original torrent files #defaults write org.m0k.transmission DeleteOriginalTorrent -bool true # Hide the donate message #defaults write org.m0k.transmission WarningDonate -bool false # Hide the legal disclaimer #defaults write org.m0k.transmission WarningLegal -bool false ############################################################################### # Twitter.app # ############################################################################### # Disable smart quotes as it’s annoying for code tweets defaults write com.twitter.twitter-mac AutomaticQuoteSubstitutionEnabled -bool false # Show the app window when clicking the menu bar icon defaults write com.twitter.twitter-mac MenuItemBehavior -int 1 # Enable the hidden ‘Develop’ menu defaults write com.twitter.twitter-mac ShowDevelopMenu -bool true # Open links in the background defaults write com.twitter.twitter-mac openLinksInBackground -bool true # Allow closing the ‘new tweet’ window by pressing `Esc` defaults write com.twitter.twitter-mac ESCClosesComposeWindow -bool true # Show full names rather than Twitter handles defaults write com.twitter.twitter-mac ShowFullNames -bool true # Hide the app in the background if it’s not the front-most window defaults write com.twitter.twitter-mac HideInBackground -bool true ############################################################################### # Kill affected applications # ############################################################################### for app in "Activity Monitor" "Address Book" "Calendar" "Contacts" "cfprefsd" \ "Dock" "Finder" "Mail" "Messages" "Safari" "SizeUp" "SystemUIServer" \ "Terminal" "Transmission" "Twitter" "iCal"; do killall "${app}" > /dev/null 2>&1 done echo "Done. Note that some of these changes require a logout/restart to take effect."
#/bin/bash cat >> ~/.bashrc <<_EOF_ #### set -o vi alias ll='ls -la' alias lsof='lsof' alias curl-json='curl -s -X POST -H "Content-Type:application/json" -d ' _EOF_ sh ~/.bashrc
#!/bin/bash set -x set -e source "/tools/common_rc/functions.sh" apt-get update # install SSHD apt-get install -y --no-install-recommends ssh # let root logins, disable password logins sed -i \ -e 's/^#?UsePAM.*$/UsePAM no/g' \ -e 's/^#?PasswordAuthentication.*$/PasswordAuthentication yes/g' \ -e 's/^#?PermitRootLogin.*$/PermitRootLogin yes/g' \ -e 's/^#?UseDNS.*$/UseDNS no/g' \ -e 's/AcceptEnv LANG.*//' \ /etc/ssh/sshd_config mkdir -p /var/run/sshd echo 'root:root' | chpasswd echo " ### Install git with flow and lfs plugins ... " apt-get install -y --no-install-recommends openssh-client git git-flow git-lfs echo 'Setup nice PS1 to use with git...' \ && wget -q "https://gist.githubusercontent.com/devopsnfq/75045ae9f3f3ad49b50a61315e22d144/raw/27dbc5aecdedd7843508b205129cf7a1329a17a6/git_bash_prompt.sh" -O /home/project/.git_bash_prompt.sh \ && echo '. ~/.git_bash_prompt.sh' >> /home/project/.bashrc \ && chown project:project /home/project/.git_bash_prompt.sh \ && echo -e '\n\nDONE\n' # make directories not that dark on dark background echo 'DIR 30;47' > /home/project/.dircolors chown project:project /home/project/.dircolors echo 'adding git aliases...' \ && echo alias gl=\"git log --pretty=format:\'%C\(bold blue\)%h %Creset-%C\(bold yellow\)%d %C\(red\)%an %C\(green\)%s\' --graph --date=short --decorate --color --all\" >> /home/project/.bash_aliases \ && echo 'alias pull-all='\''CB=$(git branch | grep ^\* | cut -d" " -f2); git branch | grep -o [a-z].*$ | xargs -n1 -I{} bash -c "git checkout {} && git pull"; git checkout "$CB"'\' >> /home/project/.bash_aliases \ && chown project:project /home/project/.bash_aliases \ && echo -e '\n\nDONE\n' echo 'enable bash_custom inside dev container' echo 'if [ -f ~/.bash_custom ]; then . ~/.bash_custom ; fi' >> /home/project/.bashrc # install mysql-client apt-get install -y --no-install-recommends mariadb-client # install composer phpEnableModule json phpEnableModule phar phpEnableModule zip phpEnableModule iconv curl -sSL 'https://getcomposer.org/download/1.10.24/composer.phar' > /usr/local/bin/composer.phar chmod a+x /usr/local/bin/composer.phar ln -s /usr/local/bin/composer.phar /usr/local/bin/composer composer self-update --1 # installl hiroku/prestissimo phpEnableModule curl sudo -u project composer --no-interaction global require "hirak/prestissimo:^0.3" # disable enabled modules phpDisableModule curl phpDisableModule json phpDisableModule phar phpDisableModule zip # install phpunit phpEnableModule phar curl -sSL 'https://phar.phpunit.de/phpunit-6.5.9.phar' > /usr/local/bin/phpunit.phar chmod a+x /usr/local/bin/phpunit.phar ln -s /usr/local/bin/phpunit.phar /usr/local/bin/phpunit cp -frv /build/files/* / # Clean up APT when done. source /usr/local/build_scripts/cleanup_apt.sh
<gh_stars>0 $(document).ready(function(){ $('.create_item').click(function(){ var tags = $('#tagsArr').val(); console.log(tags); }) })
'use strict'; // Создай плагин настраиваемого таймера, который ведет обратный отсчет до // предварительно определенной даты. Такой плагин может использоваться // в блогах и интернет-магазинах, страницах регистрации событий, во время // технического обслуживания и т. д. // Плагин ожидает следующую HTML-разметку и показывает четыре цифры: дни, часы, // минуты и секунды в формате XX:XX:XX:XX. Количество дней может состоять из более чем двух цифр. // Плагин это класс CountdownTimer, экземпляр которого создает новый таймер с настройками. // new CountdownTimer({ // selector: '#timer-1', // targetDate: new Date('Jul 17, 2020'), // }); // Для подсчета значений используй следующие готовые формулы, // где time - разница между targetDate и текущей датой. /* * Оставшиеся дни: делим значение UTC на 1000 * 60 * 60 * 24, количество * миллисекунд в одном дне (миллисекунды * секунды * минуты * часы) */ // const days = Math.floor(time / (1000 * 60 * 60 * 24)); /* * Оставшиеся часы: получаем остаток от предыдущего расчета с помощью оператора * остатка % и делим его на количество миллисекунд в одном часе * (1000 * 60 * 60 = миллисекунды * минуты * секунды) */ // const hours = Math.floor((time % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); /* * Оставшиеся минуты: получаем оставшиеся минуты и делим их на количество * миллисекунд в одной минуте (1000 * 60 = миллисекунды * секунды) */ // const mins = Math.floor((time % (1000 * 60 * 60)) / (1000 * 60)); /* * Оставшиеся секунды: получаем оставшиеся секунды и делим их на количество * миллисекунд в одной секунде (1000) */ // const secs = Math.floor((time % (1000 * 60)) / 1000); // ============================ class CountdownTimer { constructor({ selector, targetDate }) { this.selector = selector; this.targetDate = targetDate; } timerDivSet() { return document .querySelector(this.selector) .querySelectorAll('span[data-value]'); } myTime(time) { const fullTime = {}; fullTime.days = Math.floor(time / (1000 * 60 * 60 * 24)); fullTime.hours = this.addZero(Math.floor( (time % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60), )); fullTime.mins = this.addZero(Math.floor((time % (1000 * 60 * 60)) / (1000 * 60))); fullTime.secs = this.addZero(Math.floor((time % (1000 * 60)) / 1000)); return fullTime; } changeMarkup() { const restTime = this.targetDate - new Date(); this.timerDivSet().forEach(element => { element.textContent = this.myTime(restTime)[element.dataset.value]; }); } addZero(num) { return String(num).padStart(2, '0'); } } const myCounter = new CountdownTimer({ selector: '#timer-1', targetDate: new Date('Jul 17, 2020'), }); const intervalId = setInterval(myCounter.changeMarkup.bind(myCounter), 1000); // clearInterval(intervalId);
#include <iostream> #include <fstream> #include <map> #include <string> #include <cctype> #include <algorithm> int main() { std::ifstream file("input.txt"); std::map<std::string, int> wordCount; if (file.is_open()) { std::string word; while (file >> word) { // Remove punctuation and convert to lowercase word.erase(std::remove_if(word.begin(), word.end(), ::ispunct), word.end()); std::transform(word.begin(), word.end(), word.begin(), ::tolower); if (!word.empty()) { wordCount[word]++; } } file.close(); // Output word count for each unique word in alphabetical order for (const auto& pair : wordCount) { std::cout << pair.first << ": " << pair.second << std::endl; } } else { std::cerr << "Error opening file." << std::endl; } return 0; }
import unittest import json import os import guavahash BASE_DIR = os.path.dirname(os.path.abspath(__file__)) class TestCase(unittest.TestCase): def test_basic(self): with open(os.path.join(BASE_DIR, 'testdata.json'), 'r') as f: testdata = f.read() case_arr = json.loads(testdata) for case in case_arr: state, n_buckets, expected = tuple(case) guava_res = guavahash.guava(state, n_buckets) message = "({0}, {1}) => {2} vs {3}".format(state, n_buckets, expected, guava_res) self.assertEqual(guava_res, expected, message)
#!/bin/sh TARGET=target_macos rm -fr $TARGET mkdir $TARGET cd $TARGET cmake ../../ -DCMAKE_TOOLCHAIN_FILE=../macos.cmake make ls -l -h ../../target/
import subprocess import os def convert_to_glb(input_file: str, embed_external_data: bool) -> str: embed_option = "--embed" if embed_external_data else "--no-embed" output_file = os.path.splitext(input_file)[0] + ".glb" subprocess.run(["./gltf2glb.py", input_file, embed_option]) return output_file
#! /usr/bin/env bash # Defines global settings. # General set -o nounset set -o errexit set -o pipefail IFS=$'\n\t' # Homebrew export HOMEBREW_CURL_RETRIES=3 export DOCKER_APP_NAME="Docker.app" export DOCKER_VOLUME_NAME="Docker" if [[ "$(/usr/bin/arch)" == "arm64" ]]; then export DOCKER_APP_URL="https://desktop.docker.com/mac/stable/arm64/Docker.dmg" else export DOCKER_APP_URL="https://desktop.docker.com/mac/stable/amd64/Docker.dmg" fi # Application Extensions export VIM_EXTENSION_ROOT="$HOME/.vim/bundle" export VIM_BLOCKLE_EXTENSION_PATH="$VIM_EXTENSION_ROOT/vim-blockle" export VIM_BLOCKLE_EXTENSION_URL="https://github.com/tpope/vim-bundler" export VIM_BUNDLER_EXTENSION_PATH="$VIM_EXTENSION_ROOT/vim-bundler" export VIM_BUNDLER_EXTENSION_URL="https://github.com/tpope/vim-bundler" export VIM_COMMENTARY_EXTENSION_PATH="$VIM_EXTENSION_ROOT/vim-commentary" export VIM_COMMENTARY_EXTENSION_URL="https://github.com/tpope/vim-commentary.git" export VIM_FUGITIVE_EXTENSION_PATH="$VIM_EXTENSION_ROOT/vim-fugitive" export VIM_FUGITIVE_EXTENSION_URL="https://github.com/tpope/vim-fugitive.git" export VIM_GIT_GUTTER_EXTENSION_PATH="$VIM_EXTENSION_ROOT/vim-gitgutter" export VIM_GIT_GUTTER_EXTENSION_URL="https://github.com/airblade/vim-gitgutter.git" export VIM_PATHOGEN_EXTENSION_PATH="$HOME/.vim/autoload/pathogen.vim" export VIM_PATHOGEN_EXTENSION_URL="https://raw.githubusercontent.com/tpope/vim-pathogen/master/autoload/pathogen.vim" export VIM_PROJECTIONIST_EXTENSION_PATH="$VIM_EXTENSION_ROOT/vim-projectionist" export VIM_PROJECTIONIST_EXTENSION_URL="https://github.com/tpope/vim-projectionist.git" export VIM_RAILS_EXTENSION_PATH="$VIM_EXTENSION_ROOT/vim-rails" export VIM_RAILS_EXTENSION_URL="https://github.com/tpope/vim-rails.git" export VIM_RUBY_EXTENSION_PATH="$VIM_EXTENSION_ROOT/vim-ruby" export VIM_RUBY_EXTENSION_URL="https://github.com/vim-ruby/vim-ruby.git" export VIM_SPLITJOIN_EXTENSION_PATH="$VIM_EXTENSION_ROOT/splitjoin" export VIM_SPLITJOIN_EXTENSION_URL="https://github.com/AndrewRadev/splitjoin.vim.git" export VIM_TEXT_OBJECT_EXTENSION_PATH="$VIM_EXTENSION_ROOT/vim-textobj-user" export VIM_TEXT_OBJECT_EXTENSION_URL="https://github.com/kana/vim-textobj-user.git" export VIM_TEXT_OBJECT_RUBY_BLOCK_EXTENSION_PATH="$VIM_EXTENSION_ROOT/vim-textobj-rubyblock" export VIM_TEXT_OBJECT_RUBY_BLOCK_EXTENSION_URL="https://github.com/nelstrom/vim-textobj-rubyblock.git" export VIM_UNIMPAIRED_EXTENSION_PATH="$VIM_EXTENSION_ROOT/vim-unimpaired" export VIM_UNIMPAIRED_EXTENSION_URL="https://github.com/tpope/vim-unimpaired.git"
module.exports = { Monster: require('./Monster'), DropTable: require('./DropTable'), };
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.pamarin.chapter2; import java.util.Scanner; /** * * @author Aom-Cpe */ public class StringLength { public static void main(String[] args) { String concade = "", number = ""; String str, last3; Scanner scan = new Scanner(System.in); System.out.print("Enter Sting : "); str = scan.nextLine(); System.out.println("Length = " + str.length()); last3 = str.substring(str.length() - 3, str.length()); System.out.println("The last 3 char : " + last3); for (int i = 0; i < str.length(); i++) { char c = str.charAt(i); if (Character.isDigit(c)) { number = number + c; } else { concade = concade + c; } } System.out.println("String = " + concade); System.out.println("Number = " + number); } }
<gh_stars>0 /* Contains various storage benchmarks */ package test /* TestTest is a test */ var TestTest = Test{ Name: "Test Test", Prereq: nil, Deps: []Dependency{ NewFileDependency("/tmp/asdasdasd", "http://www.example.com/index.html"), }, } /* Common sets up common files for all tests. */ var Common = Test{ Name: "Common Test Files", Prereq: nil, Deps: []Dependency{ NewAptDependency("build-essential"), NewAptDependency("automake"), NewAptDependency("cmake"), NewAptDependency("wget"), NewAptDependency("tar"), NewAptDependency("libtool"), NewAptDependency("bison"), NewAptDependency("flex"), NewAptDependency("git"), }, } /* Filebench is the filebench benchmarking software. */ var Filebench = Test{ Name: "Filebench", Prereq: &Common, Deps: []Dependency{ NewAptDependency("build-essential"), }, }
<filename>services/api/fixtures/categories/index.js const CATEGORIES = [ 'jewelry', 'toy', 'florist', 'hairdresser', 'barber', 'shoe', 'clothes', 'hardware', 'delicatessen', 'books', 'pets', 'chemist', 'fishmonger', 'butcher', 'baker', 'supermarket', 'grocer', 'department', 'tea', 'music', 'optician', 'travel', 'design', ]; const fixtures = {}; for (let name of CATEGORIES) { fixtures[name] = { name }; } module.exports = fixtures;
import {jsx} from "@emotion/core"; import {FC} from "react"; import {Surface} from "./Surface"; import {useTheme} from "../services/useTheme"; import {IconButton} from "@fluentui/react"; import {useIsMobileView} from "../services/useIsMobileView"; export const Card: FC<{ revealed: boolean; halfRevealed?: boolean; children: string; onRemove?: () => void; onClick?: () => void; }> = ({revealed, halfRevealed, children, onRemove, ...rest}) => { const theme = useTheme(); const isMobile = useIsMobileView(); const removeButton = ( <IconButton iconProps={{iconName: "ChromeClose"}} title="Remove" ariaLabel="Remove" onClick={onRemove} styles={{ icon: {color: theme.palette.black}, root: {float: "right"}, }} /> ); return ( <Surface elevation="elevation16" css={{ width: 160, height: 220, boxSizing: "border-box", wordBreak: "break-word", padding: theme.spacing.s1, fontSize: 18, ...(halfRevealed && !revealed && {color: "rgba(60,60,60,0.5)"}), ...(isMobile && {width: "100%", height: "auto", minHeight: 38}), }} {...rest}> {onRemove && (isMobile ? ( removeButton ) : ( <div> {removeButton} <br css={{clear: "both"}} /> </div> ))} <div css={{ display: "-webkit-box", WebkitLineClamp: (isMobile ? 4 : 8) - (onRemove ? 1 : 0), WebkitBoxOrient: "vertical", overflow: "hidden", }} {...((revealed || halfRevealed) && {title: children})}> {(revealed || halfRevealed) && children} </div> </Surface> ); };
def printArray(arr): for item in arr: print(item)
<gh_stars>0 /* * @(#)Curves.java 1.25 04/07/26 * * Copyright (c) 2004 Sun Microsystems, Inc. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * -Redistribution of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * -Redistribution in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * Neither the name of Sun Microsystems, Inc. or the names of contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * This software is provided "AS IS," without a warranty of any kind. ALL * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING * ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE * OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") * AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE * AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS * DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST * REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, * INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY * OF LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. * * You acknowledge that this software is not designed, licensed or intended * for use in the design, construction, operation or maintenance of any * nuclear facility. */ /* * @(#)Curves.java 1.25 04/07/26 */ package java2d.demos.Arcs_Curves; import java.awt.*; import java.awt.geom.Ellipse2D; import java.awt.geom.Rectangle2D; import java.awt.geom.QuadCurve2D; import java.awt.geom.CubicCurve2D; import java.awt.geom.PathIterator; import java.awt.geom.FlatteningPathIterator; import java.awt.font.TextLayout; import java.awt.font.FontRenderContext; import java2d.Surface; /** * CubicCurve2D & QuadCurve2D curves includes FlattenPathIterator example. */ public class Curves extends Surface { private static Color colors[] = { Color.blue, Color.green, Color.red }; public Curves() { setBackground(Color.white); } public void render(int w, int h, Graphics2D g2) { int y = 0; g2.setColor(Color.black); FontRenderContext frc = g2.getFontRenderContext(); TextLayout tl = new TextLayout("QuadCurve2D", g2.getFont(), frc); float xx = (float) (w*.5-tl.getBounds().getWidth()/2); tl.draw(g2, xx, tl.getAscent()); tl = new TextLayout("CubicCurve2D", g2.getFont(), frc); xx = (float) (w*.5-tl.getBounds().getWidth()/2); tl.draw(g2, xx, h*.5f); g2.setStroke(new BasicStroke(5.0f)); float yy = 20; for (int i = 0; i < 2; i++) { for (int j = 0; j < 3; j++) { Shape shape = null; if (i == 0) { shape = new QuadCurve2D.Float(w*.1f,yy,w*.5f,50,w*.9f,yy); } else { shape = new CubicCurve2D.Float(w*.1f,yy,w*.4f,yy-15, w*.6f,yy+15,w*.9f,yy); } g2.setColor(colors[j]); if (j != 2) g2.draw(shape); if (j == 1 ) { g2.setColor(Color.lightGray); PathIterator f = shape.getPathIterator(null); while ( !f.isDone() ) { float[] pts = new float[6]; switch ( f.currentSegment(pts) ) { case PathIterator.SEG_MOVETO: case PathIterator.SEG_LINETO: g2.fill(new Rectangle2D.Float(pts[0], pts[1], 5, 5)); break; case PathIterator.SEG_CUBICTO : case PathIterator.SEG_QUADTO : g2.fill(new Rectangle2D.Float(pts[0], pts[1], 5, 5)); if (pts[2] != 0) { g2.fill(new Rectangle2D.Float(pts[2], pts[3], 5, 5)); } if (pts[4] != 0) { g2.fill(new Rectangle2D.Float(pts[4], pts[5], 5, 5)); } } f.next(); } } else if (j == 2) { PathIterator p = shape.getPathIterator(null); FlatteningPathIterator f = new FlatteningPathIterator(p,0.1); while ( !f.isDone() ) { float[] pts = new float[6]; switch ( f.currentSegment(pts) ) { case PathIterator.SEG_MOVETO: case PathIterator.SEG_LINETO: g2.fill(new Ellipse2D.Float(pts[0], pts[1],3,3)); } f.next(); } } yy += h/6; } yy = h/2+15; } } public static void main(String argv[]) { createDemoFrame(new Curves()); } }
<reponame>Singularity-Coder/FOLK-Database package com.singularitycoder.folkdatabase.helper; import android.annotation.SuppressLint; import android.content.Context; import android.util.AttributeSet; import android.view.ActionMode; import android.view.Menu; import android.view.MenuItem; import android.view.MotionEvent; import android.widget.EditText; import android.widget.TextView; import java.lang.reflect.Field; @SuppressLint("AppCompatCustomView") public class CustomEditText extends EditText { public CustomEditText(Context context) { super(context); init(); } public CustomEditText(Context context, AttributeSet attrs) { super(context, attrs); init(); } public CustomEditText(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); init(); } private void init() { this.setCustomSelectionActionModeCallback(new BlockedActionModeCallback()); this.setLongClickable(false); } @SuppressLint("ClickableViewAccessibility") @Override public boolean onTouchEvent(MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_DOWN) { this.setInsertionDisabled(); } return super.onTouchEvent(event); } /** * This method sets TextView#Editor#mInsertionControllerEnabled field to false * to return false from the Editor#hasInsertionController() method to PREVENT showing * of the insertionController from EditText * The Editor#hasInsertionController() method is called in Editor#onTouchUpEvent(MotionEvent event) method. */ private void setInsertionDisabled() { try { Field editorField = TextView.class.getDeclaredField("mEditor"); editorField.setAccessible(true); Object editorObject = editorField.get(this); Class editorClass = Class.forName("android.widget.Editor"); Field mInsertionControllerEnabledField = editorClass.getDeclaredField("mInsertionControllerEnabled"); mInsertionControllerEnabledField.setAccessible(true); mInsertionControllerEnabledField.set(editorObject, false); } catch (Exception ignored) { // ignore exception here } } @Override public boolean isSuggestionsEnabled() { return false; } private class BlockedActionModeCallback implements ActionMode.Callback { public boolean onCreateActionMode(ActionMode mode, Menu menu) { return false; } public boolean onPrepareActionMode(ActionMode mode, Menu menu) { return false; } public boolean onActionItemClicked(ActionMode mode, MenuItem item) { return false; } public void onDestroyActionMode(ActionMode mode) { } } }
package com.ramusthastudio.myalarmmanager; import android.app.AlarmManager; import android.app.NotificationChannel; import android.app.NotificationManager; import android.app.PendingIntent; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.media.RingtoneManager; import android.net.Uri; import android.support.v4.app.NotificationCompat; import android.support.v4.content.ContextCompat; import android.widget.Toast; public class AlarmReceiver extends BroadcastReceiver { private static final String TYPE_ONE_TIME = "OneTimeAlarm"; private static final String TYPE_REPEATING = "RepeatingAlarm"; private static final String EXTRA_MESSAGE = "message"; private static final String EXTRA_TYPE = "type"; private static final int NOTIF_ID_ONETIME = 100; private static final int NOTIF_ID_REPEATING = 101; @Override public void onReceive(Context context, Intent intent) { String type = intent.getStringExtra(EXTRA_TYPE); String message = intent.getStringExtra(EXTRA_MESSAGE); String title = type.equalsIgnoreCase(TYPE_ONE_TIME) ? "One Time Alarm" : "Repeating Alarm"; int notifId = type.equalsIgnoreCase(TYPE_ONE_TIME) ? NOTIF_ID_ONETIME : NOTIF_ID_REPEATING; showAlarmNotification(context, title, message, notifId); } private static void showAlarmNotification(Context context, String title, String message, int notifId) { NotificationManager notificationManagerCompat = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); Uri alarmSound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); NotificationCompat.Builder builder; if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) { builder = new NotificationCompat.Builder(context, NotificationChannel.DEFAULT_CHANNEL_ID); } else { builder = new NotificationCompat.Builder(context); } builder .setSmallIcon(R.drawable.ic_alarm) .setContentTitle(title) .setContentText(message) .setColor(ContextCompat.getColor(context, android.R.color.transparent)) .setVibrate(new long[] {1000, 1000, 1000, 1000, 1000}) .setSound(alarmSound); if (notificationManagerCompat != null) { notificationManagerCompat.notify(notifId, builder.build()); } } public void setOneTimeAlarm(Context context, long aDate, String message) { AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); if (alarmManager != null) { int requestCode = NOTIF_ID_ONETIME; Intent intent = new Intent(context, AlarmReceiver.class); intent.putExtra(EXTRA_MESSAGE, message); intent.putExtra(EXTRA_TYPE, TYPE_ONE_TIME); PendingIntent pendingIntent = PendingIntent.getBroadcast(context, requestCode, intent, 0); alarmManager.set(AlarmManager.RTC_WAKEUP, aDate, pendingIntent); Toast.makeText(context, "One time alarm set up", Toast.LENGTH_SHORT).show(); } } public void setRepeatingAlarm(Context context, long aDate, String message){ AlarmManager alarmManager = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE); if (alarmManager != null) { int requestCode = NOTIF_ID_REPEATING; Intent intent = new Intent(context, AlarmReceiver.class); intent.putExtra(EXTRA_MESSAGE, message); intent.putExtra(EXTRA_TYPE, TYPE_REPEATING); PendingIntent pendingIntent = PendingIntent.getBroadcast(context, requestCode, intent, 0); alarmManager.setInexactRepeating(AlarmManager.RTC_WAKEUP, aDate, AlarmManager.INTERVAL_DAY, pendingIntent); Toast.makeText(context, "Repeating alarm set up", Toast.LENGTH_SHORT).show(); } } public void cancelAlarm(Context context) { AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); if (alarmManager != null) { Intent intent = new Intent(context, AlarmReceiver.class); int requestCode = NOTIF_ID_REPEATING; PendingIntent pendingIntent = PendingIntent.getBroadcast(context, requestCode, intent, 0); alarmManager.cancel(pendingIntent); } } }
<gh_stars>0 from __future__ import unicode_literals import frappe from frappe.model.document import Document def autoname(doc, method=None): update_naming_series(doc) def on_submit(doc, method = None): if doc.is_assembly: manage_assembly(doc) def on_update_after_submit(doc, method = None): if doc.is_assembly: manage_assembly(doc) def manage_assembly(doc): existed_assembly = frappe.db.sql("""SELECT distinct name from tabBOM where is_assembly and item_name='{0}' """.format(doc.item_name), as_dict=1) for i in existed_assembly: if i.name != doc.name: frappe.db.set_value("BOM", i.name,'is_assembly', 0 ) else: frappe.db.set_value("BOM", i.name,'is_assembly', 1) def update_naming_series(doc): naming_series = doc.naming_series+doc.item+'-' current_count = frappe.db.sql("""select MAX(current) AS current from `tabSeries` where name = '{0}'""".format(naming_series),as_dict=1) current = current_count[0].get('current') if current is None: current = 1 series = str(current) doc_name = naming_series + series.zfill(5) frappe.db.sql("insert into tabSeries (name, current) values (%s, 1)", (naming_series)) doc.name = doc_name else: current = current + 1 series = str(current) new_name = naming_series + series.zfill(5) frappe.db.sql("""update tabSeries set current = {0} where name = '{1}'""".format(current, naming_series)) doc.name = new_name
import createUseRestful from './createUseRestful'; export default createUseRestful;
// // InternalService.h // OperationQueueLeak // // Created by <NAME> on 21/10/2021. // #import <Foundation/Foundation.h> NS_ASSUME_NONNULL_BEGIN @class CoreDataLayer; @interface InternalService : NSObject - (instancetype)initWithCoreDataLayer:(CoreDataLayer *)coreDataLayer; @end NS_ASSUME_NONNULL_END
package io.opensphere.server.control; import java.awt.Component; import java.util.Collection; import org.apache.commons.lang3.StringUtils; import io.opensphere.core.Toolbox; import io.opensphere.core.control.ui.DefaultComponentSupplier; import io.opensphere.core.util.PausingTimeBudget; import io.opensphere.core.util.ValidationStatus; import io.opensphere.core.util.collections.CollectionUtilities; import io.opensphere.server.display.OGCServerValidationEnvoy; import io.opensphere.server.display.ServiceValidator; import io.opensphere.server.services.OGCServiceValidationResponse; import io.opensphere.server.services.OGCServiceValidator; import io.opensphere.server.services.ServerConnectionParams; import io.opensphere.server.source.OGCServerSource; import io.opensphere.server.toolbox.ServerToolboxUtils; import io.opensphere.server.toolbox.ServerValidatorRegistry; /** * Validates an OGC service. */ public class ServiceValidatorImpl extends ServiceValidator<OGCServerSource> { /** The toolbox. */ private final transient Toolbox myToolbox; /** The parent component. */ private Component myParentComponent; /** The data source. */ private OGCServerSource mySource; /** The service. */ private String myService; /** Envoy used to execute "validate" commands. */ private transient OGCServerValidationEnvoy myValidationEnvoy; /** * Constructor. * * @param toolbox the toolbox */ public ServiceValidatorImpl(Toolbox toolbox) { super(); myToolbox = toolbox; } @Override public ValidationStatus getValidationStatus() { validateService(); return super.getValidationStatus(); } @Override public void setParent(Component parent) { myParentComponent = parent; } @Override public void setService(String service) { myService = service; } @Override public void setSource(OGCServerSource source) { mySource = source; } /** * Gets the validation envoy. * * @return the validation envoy */ private OGCServerValidationEnvoy getValidationEnvoy() { if (myValidationEnvoy == null) { Collection<OGCServerValidationEnvoy> envoys = myToolbox.getEnvoyRegistry() .getObjectsOfClass(OGCServerValidationEnvoy.class); if (CollectionUtilities.hasContent(envoys)) { myValidationEnvoy = envoys.iterator().next(); } } return myValidationEnvoy; } /** * Validate the URL for a given service. */ private void validateService() { ValidationStatus isValid = ValidationStatus.ERROR; String displayError = null; String url = mySource.getURL(myService); if (StringUtils.isNotEmpty(url)) { ServerValidatorRegistry validationRegistry = ServerToolboxUtils.getServerValidatorRegistry(myToolbox); OGCServiceValidator validator = validationRegistry.retrieve(myService); if (validator != null) { final PausingTimeBudget timeBudget = PausingTimeBudget.startMillisecondsPaused(30000L); ServerConnectionParams config = new ServerConnectionParamsImpl(mySource, new DefaultComponentSupplier(myParentComponent), myToolbox, timeBudget); OGCServiceValidationResponse response = getValidationEnvoy().validate(validator, config, timeBudget); if (response.isValid()) { isValid = ValidationStatus.VALID; } else { String message = StringUtils.isEmpty(response.getErrorMessage()) ? "Unknown error" : response.getErrorMessage(); displayError = "Error validating " + myService + " Server: \n\n" + message; } } else { displayError = "Error validating " + myService + " Server: \n\nNo plugin is registered for " + myService + " validation"; } } else { displayError = "Error validating " + myService + " Server: \n\nEmpty URL for " + myService + " validation"; } setValidationResult(isValid, displayError); } }
public class MainActivity extends AppCompatActivity { private RecyclerView movieListView; private List<Movie> movieList = new ArrayList<>(); private MovieAdapter movieAdapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); movieListView = (RecyclerView) findViewById(R.id.movie_list); // Set up LayoutManager RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(this); movieListView.setLayoutManager(layoutManager); // Load data from API fetchMoviesFromAPI(); // Set up Adapter movieAdapter = new MovieAdapter(movieList); movieListView.setAdapter(movieAdapter); } private void fetchMoviesFromAPI() { // TODO: Send request to API and parse response } }
#!/usr/bin/env bash # # Encrypt sonatype credentials so that they can be # decrypted in trusted builds on Travis CI. # set -e read -s -p 'SONA_USER: ' SONA_USER travis encrypt SONA_USER="$SONA_USER" read -s -p 'SONA_PASS: ' SONA_PASS travis encrypt SONA_PASS="$SONA_PASS"
/* * Copyright (c) 2017 <NAME> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.pureperfect.ferret; import java.io.File; import java.io.FileFilter; /** * ResourceFilter to select only jar files. * * @author J. <NAME> * @version 1.0 * @since 1.0 */ class JARFileFilter implements FileFilter { private static final JARFileFilter singleton = new JARFileFilter(); /** * Get a singleton instance. * * @return a singleton instance. */ public static final JARFileFilter defaultInstance() { return JARFileFilter.singleton; } /* * (non-Javadoc) * * @see java.io.FileFilter#accept(java.io.File) */ @Override public boolean accept(final File pathname) { return pathname.getName().endsWith(".jar"); } }
export GOOS=linux go build pgmen.go
#!/bin/sh # Written by Tong He and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md # This script is specific to CBIG HPC cluster. # check whether have already run RESULT_DIR="$1/ukbb_rng_num_$5" FILE=$RESULT_DIR/final_result.mat if [ -f "$FILE" ]; then echo "$FILE exist" exit 0 fi # sleep 5s to reduce job scheduler load sleep 5s # remove old log directory if exists, create new one LOG_DIR="$1/log/log_rng_$5" rm -rf ${LOG_DIR} mkdir -p ${LOG_DIR} mkdir -p ${RESULT_DIR} # submit job JOB=`$CBIG_SCHEDULER_DIR/qsub -V <<EOJ #!/bin/bash #PBS -l ncpus=1 #PBS -l walltime=200:00:00 #PBS -l mem=60gb #PBS -m ae #PBS -e ${LOG_DIR}/stderr.txt #PBS -o ${LOG_DIR}/stdout.txt matlab -nosplash -nodisplay -nodesktop -r " \ addpath('$3'); \ CBIG_MM_KRR_MM_base('$CBIG_CODE_DIR', '$7', '$2', '$8', '$1', '$5', '$6', '$9', '${10}'); \ exit;" echo ${LOG_DIR} EOJ` echo "JobID = ${JOB} for rng $5 and $6 submitted"
# genkernel (8) completion # Copyright 1999-2019 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # Written by Aron Griffis <agriffis@gentoo.org> _genkernel() { declare cur prev genkernel_help actions params COMPREPLY=() cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} # extract initial list of params/actions from genkernel --help genkernel_help=$(command genkernel --help 2>/dev/null) actions=( $(<<<"$genkernel_help" sed -n \ '/^Available Actions:/,/^$/s/^[[:space:]]\+\([^[:space:]]\+\).*/\1/p') ) params=( $(<<<"$genkernel_help" egrep -oe '--[^[:space:]]{2,}') ) # attempt to complete the current parameter based on the list COMPREPLY=($(compgen -W "${params[*]/=*/=} ${actions[*]}" -- "$cur")) # if we don't have a rhs to complete if [[ ${#COMPREPLY[@]} -gt 1 ]]; then return elif [[ ${#COMPREPLY[@]} -eq 0 && $cur != --*=* ]]; then return elif [[ ${#COMPREPLY[@]} -eq 1 && $COMPREPLY != --*= ]]; then # using nospace completion, add an explicit space COMPREPLY="${COMPREPLY} " return fi # we have a unique lhs and need to complete the rhs declare args lhs rhs if [[ ${#COMPREPLY[@]} -eq 1 ]]; then lhs=$COMPREPLY else lhs=${cur%%=*}= rhs=${cur#*=} fi # genkernel's help gives clues as to what belongs on the rhs. # extract the clue for the current parameter args=" ${params[*]} " args="${args##* $lhs}" args="${args%% *}" # generate a list of completions for the argument; this replaces args with # an array of results args=( $(case $args in ('<0-5>') compgen -W "$(echo {1..5})" -- "$rhs" ;; ('<outfile>'|'<file>') compgen -A file -o plusdirs -- "$rhs" ;; ('<archive>') compgen -G '*.tar.xz' -G '*.tbz2' -G '*.tar.bz2' -o plusdirs -- "$rhs" ;; ('<dir>'|'<path>') compgen -A directory -S / -- "$rhs" ;; (*) compgen -o bashdefault -- "$rhs" ;; # punt esac) ) # we're using nospace completion to prevent spaces after paths that aren't # "done" yet. So do some hacking to the args to add spaces after # non-directories. declare slash=/ args=( "${args[@]/%/ }" ) # add space to all args=( "${args[@]/%$slash /$slash}" ) # remove space from dirs # recreate COMPREPLY if [[ $cur == "$lhs"* ]]; then COMPREPLY=( "${args[@]}" ) elif [[ ${#args[@]} -gt 0 ]]; then COMPREPLY=( "${args[@]/#/$lhs}" ) fi } complete -o nospace -F _genkernel genkernel
#!/bin/bash set -e cd "$(dirname "$(realpath "$0")")" valid_host_names=(registry proxy bastion) validate () { for valid_host_name in "${valid_host_names[@]}"; do if [ "$1" = "$valid_host_name" ]; then return 0 fi done return 1 } node="${1?' You must provide a host to connect to'}" && validate "$1" || { echo 'Please supply a valid hostname as an argument.' >&2; exit 1; } if [ -f output/cluster_name ]; then cluster_name=$(tr -d '[:space:]' < output/cluster_name) else cluster_name=disco fi cluster_domain=$(grep '^cluster_domain:' vars.yml | cut -d: -f2- | tr -d ' ') ssh_args=( -i "output/${cluster_name}_ed25519" -o IdentitiesOnly=yes -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -q ) if [ "$node" = "bastion" ]; then node=bastion.internal ssh_args+=( -o ProxyCommand="ssh -W %h:%p ${ssh_args[*]} ec2-user@proxy.$cluster_name.$cluster_domain" ) fi export TERM=xterm-256color exec ssh "${ssh_args[@]}" "ec2-user@$node.$cluster_name.$cluster_domain"
#!/bin/bash p=${PWD} p=${p//\//\\\/} NMRoot=${PWD} sed 's/NMHOME/'${p}'/g' execute.dat > execute sed 's/NMHOME/'${p}'/g' bootstrap.dat > bootstrap sed 's/NMHOME/'${p}'/g' nmfe74.dat > util/nmfe74 sudo chmod +x execute sudo chmod +x bootstrap sudo chmod +x util/nmfe74 if [ -e '/usr/local/bin' ];then cd /usr/local/bin if [ -e 'execute' ];then sudo rm execute fi cd /usr/local/bin if [ -e 'execute' ];then sudo rm execute fi if [ -e 'nmfe74' ];then sudo rm nmfe74 fi if [ -e 'bootstrap' ];then sudo rm bootstrap fi if [ -e 'nmfe74' ];then sudo rm util/nmfe74 fi sudo ln -s ${NMRoot}/bootstrap sudo ln -s ${NMRoot}/execute sudo ln -s ${NMRoot}/util/nmfe74 cd ${NMRoot} cd models echo "===============================TEST ONE===============================" echo "Run test model with execute ......" echo "" echo "" echo "" echo "" echo "" execute CONTROL5.mod echo "" echo "" echo "" echo "" echo "" echo "================================TEST TWO===============================" echo "Run test model with nmfe74 ......" nmfe74 CONTROL5.mod OUTPUT5 echo "" echo "" echo "" echo "" echo "" echo "================================TEST THREE===============================" echo "Run execute with mpi ......" echo "" echo "" echo "" echo "" echo "" execute -parafile=pirana_auto_mpi.pnm CONTROL5.mod -nodes='4' echo "" echo "" echo "" echo "" echo "" echo "================================TEST FOUR===============================" echo "Run nmfe74 with mpi ......" echo "" echo "" echo "" echo "" echo "" nmfe74 CONTROL5.mod OUTPUT5 "-parafile=pirana_auto_mpi.pnm" "[nodes]=4" echo "" echo "" echo "" echo "" echo "" cd .. echo "===============================TEST DONE================================" else echo "No /usr/local/bin in your system ..." fi
var http = require('./http') var Client = require('./client') var Options = require('./options') var defaults = require('./defaults') var Resilient = require('./resilient') module.exports = Resilient Resilient.VERSION = '0.4.0' Resilient.CLIENT_VERSION = http.VERSION Resilient.defaults = defaults Resilient.Options = Options Resilient.Client = Client Resilient.request = http http.LIBRARY_VERSION = Resilient.VERSION // Force globalization in browsers if (typeof window !== 'undefined' && typeof require === 'function') { window.resilient = Resilient }
<filename>pkg/util/slices/slices_test.go package slices import ( "reflect" "testing" ) func TestStringSlice_IsEmpty(t *testing.T) { type fields struct { slice StringSlice } tests := []struct { name string expected bool fields fields }{ { name: "should return true if slice is empty", fields: fields{slice: StringSlice{}}, expected: true, }, { name: "should return false if slice is not empty", fields: fields{slice: StringSlice{"some value"}}, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { actual := tt.fields.slice.IsEmpty() if !reflect.DeepEqual(actual, tt.expected) { t.Errorf("Expect: \n%+v Got: \n%+v", tt.expected, actual) } }) } } func TestStringSlice_HasString(t *testing.T) { type fields struct { slice StringSlice } type args struct { value string } tests := []struct { name string expected bool fields fields args args }{ { name: "should return true if slice has string", fields: fields{slice: StringSlice{"value", "anothervalue"}}, expected: true, args: args{value: "value"}, }, { name: "should return false if slice doesn't have string", fields: fields{slice: StringSlice{"value", "anothervalue"}}, args: args{value: "random"}, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { actual := tt.fields.slice.HasString(tt.args.value) if !reflect.DeepEqual(actual, tt.expected) { t.Errorf("Expect: \n%+v Got: \n%+v", tt.expected, actual) } }) } } func TestStringSlice_ContainsAny(t *testing.T) { type fields struct { slice StringSlice } type args struct { elements StringSlice } tests := []struct { name string expected bool fields fields args args }{ { name: "should return true if slice contains any of the given elements", fields: fields{slice: StringSlice{"value", "anothervalue"}}, expected: true, args: args{elements: StringSlice{"value"}}, }, { name: "should return false if slice doesn't contain any of the given elements", fields: fields{slice: StringSlice{"value", "anothervalue"}}, args: args{elements: StringSlice{"random"}}, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { actual := tt.fields.slice.ContainsAny(tt.args.elements...) if !reflect.DeepEqual(actual, tt.expected) { t.Errorf("Expect: \n%+v Got: \n%+v", tt.expected, actual) } }) } }
#!/bin/sh # LaunchVerifier.command # GordianServer-macOS # # Created by Peter Denton on 10/21/21. # Copyright © 2021 Peter. All rights reserved. open "$(cd "$(dirname "$0")"; pwd)"/Verify.command exit 1
# # This file maintains the rust versions for use by CI. # # Obtain the environment variables without any automatic toolchain updating: # $ source ci/rust-version.sh # # Obtain the environment variables updating both stable and nightly, only stable, or # only nightly: # $ source ci/rust-version.sh all # $ source ci/rust-version.sh stable # $ source ci/rust-version.sh nightly # Then to build with either stable or nightly: # $ cargo +"$rust_stable" build # $ cargo +"$rust_nightly" build # if [[ -n $RUST_STABLE_VERSION ]]; then stable_version="$RUST_STABLE_VERSION" else stable_version=1.43.0 fi if [[ -n $RUST_NIGHTLY_VERSION ]]; then nightly_version="$RUST_NIGHTLY_VERSION" else nightly_version=2020-04-23 fi export rust_stable="$stable_version" export rust_stable_docker_image=solanalabs/rust:"$stable_version" export rust_nightly=nightly-"$nightly_version" export rust_nightly_docker_image=solanalabs/rust-nightly:"$nightly_version" [[ -z $1 ]] || ( rustup_install() { declare toolchain=$1 if ! cargo +"$toolchain" -V; then rustup install "$toolchain" cargo +"$toolchain" -V fi } set -e cd "$(dirname "${BASH_SOURCE[0]}")" case $1 in stable) rustup_install "$rust_stable" ;; nightly) rustup_install "$rust_nightly" ;; all) rustup_install "$rust_stable" rustup_install "$rust_nightly" ;; *) echo "Note: ignoring unknown argument: $1" ;; esac )
import cv2 import pytesseract import numpy as np # Load the input image result = cv2.imread('input_image.jpg') # Use Tesseract OCR to extract text from the image data = pytesseract.image_to_string(result, lang='eng', config='--psm 10') # Filter out non-numeric characters and the decimal point processed_data = ''.join(char for char in data if char.isnumeric() or char == '.') # Display the original extracted text and the processed numerical data print(data) print(processed_data) # Display the processed versions of the input image using OpenCV cv2.imshow('thresh', thresh) # Assuming 'thresh' is a processed version of the input image cv2.imshow('opening', opening) # Assuming 'opening' is a processed version of the input image cv2.imshow('result', result) # Display the original input image cv2.waitKey(0) # Wait for a user input to close the displayed images cv2.destroyAllWindows() # Close all OpenCV windows
<reponame>WhitNearSpace/DS1820<gh_stars>0 #ifndef DS18B20_H #define DS18B20_H #include <mbed.h> #include "OneWire.h" #define DS18B20_FAMILY_CODE 0x28 class DS18B20{ public: /** * Constructor * **/ DS18B20(OneWire *onewire, char ROM[8] = 0x00); /** * Overwrite the virtual void function in OneWire * * Because this class comes with a set family code, there * should be no need for the user to access or set it * **/ void set_family_code(char family_code); char read_family_code(); bool find_ROM(); unsigned long long return_ROM(); /** * Returns floating point value of current temperature in units decided by the user * @param scale sets the units to Fahrenheit (if scale = 'F' or 'f') or Celcius in all other cases * ***/ float temperature(char scale); /*** * Collect temperature data and write it to the scratchpad * **/ int convertTemp(); /*** * Writes out the match ROM command and the specific ROM ID * * NOTE: DOES NOT SEND OUT A RESET COMMAND * **/ void matchROM(); private: char _ROM[8]; char _family_code = DS18B20_FAMILY_CODE; OneWire* _onewire; char _RAM[9]; }; #endif
import bean.Teacher; import org.junit.Test; import org.xdove.ioc.ApplicationContext; import org.xdove.ioc.exception.NoSuchBeanException; import java.io.IOException; import java.lang.reflect.InvocationTargetException; public class TestBeanFactory { @Test public void injectTest() throws InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException, IOException, ClassNotFoundException, NoSuchBeanException { //init ioc ApplicationContext applicationContext = new ApplicationContext(); applicationContext.init(); //get bean Teacher teacher = (Teacher) applicationContext.getBean(Teacher.class); //do something teacher.skill(); } }
import random def generate_random_number(min_value, max_value): return random.randint(min_value, max_value)
<gh_stars>1-10 // Generated by the protocol buffer compiler. DO NOT EDIT! // source: exposed.proto package org.dpppt.android.sdk.internal.backend.proto; public final class Exposed { private Exposed() {} public static void registerAllExtensions( com.google.protobuf.ExtensionRegistryLite registry) { } public interface ProtoExposedListOrBuilder extends // @@protoc_insertion_point(interface_extends:org.dpppt.android.sdk.internal.backend.proto.ProtoExposedList) com.google.protobuf.MessageLiteOrBuilder { /** * <code>int64 batchReleaseTime = 1;</code> * @return The batchReleaseTime. */ long getBatchReleaseTime(); /** * <code>repeated .org.dpppt.android.sdk.internal.backend.proto.ProtoExposee exposed = 2;</code> */ java.util.List<org.dpppt.android.sdk.internal.backend.proto.Exposed.ProtoExposee> getExposedList(); /** * <code>repeated .org.dpppt.android.sdk.internal.backend.proto.ProtoExposee exposed = 2;</code> */ org.dpppt.android.sdk.internal.backend.proto.Exposed.ProtoExposee getExposed(int index); /** * <code>repeated .org.dpppt.android.sdk.internal.backend.proto.ProtoExposee exposed = 2;</code> */ int getExposedCount(); } /** * Protobuf type {@code org.dpppt.android.sdk.internal.backend.proto.ProtoExposedList} */ public static final class ProtoExposedList extends com.google.protobuf.GeneratedMessageLite< ProtoExposedList, ProtoExposedList.Builder> implements // @@protoc_insertion_point(message_implements:org.dpppt.android.sdk.internal.backend.proto.ProtoExposedList) ProtoExposedListOrBuilder { private ProtoExposedList() { exposed_ = emptyProtobufList(); } public static final int BATCHRELEASETIME_FIELD_NUMBER = 1; private long batchReleaseTime_; /** * <code>int64 batchReleaseTime = 1;</code> * @return The batchReleaseTime. */ @java.lang.Override public long getBatchReleaseTime() { return batchReleaseTime_; } /** * <code>int64 batchReleaseTime = 1;</code> * @param value The batchReleaseTime to set. */ private void setBatchReleaseTime(long value) { batchReleaseTime_ = value; } /** * <code>int64 batchReleaseTime = 1;</code> */ private void clearBatchReleaseTime() { batchReleaseTime_ = 0L; } public static final int EXPOSED_FIELD_NUMBER = 2; private com.google.protobuf.Internal.ProtobufList<org.dpppt.android.sdk.internal.backend.proto.Exposed.ProtoExposee> exposed_; /** * <code>repeated .org.dpppt.android.sdk.internal.backend.proto.ProtoExposee exposed = 2;</code> */ @java.lang.Override public java.util.List<org.dpppt.android.sdk.internal.backend.proto.Exposed.ProtoExposee> getExposedList() { return exposed_; } /** * <code>repeated .org.dpppt.android.sdk.internal.backend.proto.ProtoExposee exposed = 2;</code> */ public java.util.List<? extends org.dpppt.android.sdk.internal.backend.proto.Exposed.ProtoExposeeOrBuilder> getExposedOrBuilderList() { return exposed_; } /** * <code>repeated .org.dpppt.android.sdk.internal.backend.proto.ProtoExposee exposed = 2;</code> */ @java.lang.Override public int getExposedCount() { return exposed_.size(); } /** * <code>repeated .org.dpppt.android.sdk.internal.backend.proto.ProtoExposee exposed = 2;</code> */ @java.lang.Override public org.dpppt.android.sdk.internal.backend.proto.Exposed.ProtoExposee getExposed(int index) { return exposed_.get(index); } /** * <code>repeated .org.dpppt.android.sdk.internal.backend.proto.ProtoExposee exposed = 2;</code> */ public org.dpppt.android.sdk.internal.backend.proto.Exposed.ProtoExposeeOrBuilder getExposedOrBuilder( int index) { return exposed_.get(index); } private void ensureExposedIsMutable() { if (!exposed_.isModifiable()) { exposed_ = com.google.protobuf.GeneratedMessageLite.mutableCopy(exposed_); } } /** * <code>repeated .org.dpppt.android.sdk.internal.backend.proto.ProtoExposee exposed = 2;</code> */ private void setExposed( int index, org.dpppt.android.sdk.internal.backend.proto.Exposed.ProtoExposee value) { value.getClass(); ensureExposedIsMutable(); exposed_.set(index, value); } /** * <code>repeated .org.dpppt.android.sdk.internal.backend.proto.ProtoExposee exposed = 2;</code> */ private void addExposed(org.dpppt.android.sdk.internal.backend.proto.Exposed.ProtoExposee value) { value.getClass(); ensureExposedIsMutable(); exposed_.add(value); } /** * <code>repeated .org.dpppt.android.sdk.internal.backend.proto.ProtoExposee exposed = 2;</code> */ private void addExposed( int index, org.dpppt.android.sdk.internal.backend.proto.Exposed.ProtoExposee value) { value.getClass(); ensureExposedIsMutable(); exposed_.add(index, value); } /** * <code>repeated .org.dpppt.android.sdk.internal.backend.proto.ProtoExposee exposed = 2;</code> */ private void addAllExposed( java.lang.Iterable<? extends org.dpppt.android.sdk.internal.backend.proto.Exposed.ProtoExposee> values) { ensureExposedIsMutable(); com.google.protobuf.AbstractMessageLite.addAll( values, exposed_); } /** * <code>repeated .org.dpppt.android.sdk.internal.backend.proto.ProtoExposee exposed = 2;</code> */ private void clearExposed() { exposed_ = emptyProtobufList(); } /** * <code>repeated .org.dpppt.android.sdk.internal.backend.proto.ProtoExposee exposed = 2;</code> */ private void removeExposed(int index) { ensureExposedIsMutable(); exposed_.remove(index); } public static org.dpppt.android.sdk.internal.backend.proto.Exposed.ProtoExposedList parseFrom( java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { return com.google.protobuf.GeneratedMessageLite.parseFrom( DEFAULT_INSTANCE, data); } public static org.dpppt.android.sdk.internal.backend.proto.Exposed.ProtoExposedList parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return com.google.protobuf.GeneratedMessageLite.parseFrom( DEFAULT_INSTANCE, data, extensionRegistry); } public static org.dpppt.android.sdk.internal.backend.proto.Exposed.ProtoExposedList parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return com.google.protobuf.GeneratedMessageLite.parseFrom( DEFAULT_INSTANCE, data); } public static org.dpppt.android.sdk.internal.backend.proto.Exposed.ProtoExposedList parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return com.google.protobuf.GeneratedMessageLite.parseFrom( DEFAULT_INSTANCE, data, extensionRegistry); } public static org.dpppt.android.sdk.internal.backend.proto.Exposed.ProtoExposedList parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return com.google.protobuf.GeneratedMessageLite.parseFrom( DEFAULT_INSTANCE, data); } public static org.dpppt.android.sdk.internal.backend.proto.Exposed.ProtoExposedList parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return com.google.protobuf.GeneratedMessageLite.parseFrom( DEFAULT_INSTANCE, data, extensionRegistry); } public static org.dpppt.android.sdk.internal.backend.proto.Exposed.ProtoExposedList parseFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageLite.parseFrom( DEFAULT_INSTANCE, input); } public static org.dpppt.android.sdk.internal.backend.proto.Exposed.ProtoExposedList parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageLite.parseFrom( DEFAULT_INSTANCE, input, extensionRegistry); } public static org.dpppt.android.sdk.internal.backend.proto.Exposed.ProtoExposedList parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return parseDelimitedFrom(DEFAULT_INSTANCE, input); } public static org.dpppt.android.sdk.internal.backend.proto.Exposed.ProtoExposedList parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return parseDelimitedFrom(DEFAULT_INSTANCE, input, extensionRegistry); } public static org.dpppt.android.sdk.internal.backend.proto.Exposed.ProtoExposedList parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageLite.parseFrom( DEFAULT_INSTANCE, input); } public static org.dpppt.android.sdk.internal.backend.proto.Exposed.ProtoExposedList parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageLite.parseFrom( DEFAULT_INSTANCE, input, extensionRegistry); } public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(org.dpppt.android.sdk.internal.backend.proto.Exposed.ProtoExposedList prototype) { return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); } /** * Protobuf type {@code org.dpppt.android.sdk.internal.backend.proto.ProtoExposedList} */ public static final class Builder extends com.google.protobuf.GeneratedMessageLite.Builder< org.dpppt.android.sdk.internal.backend.proto.Exposed.ProtoExposedList, Builder> implements // @@protoc_insertion_point(builder_implements:org.dpppt.android.sdk.internal.backend.proto.ProtoExposedList) org.dpppt.android.sdk.internal.backend.proto.Exposed.ProtoExposedListOrBuilder { // Construct using org.dpppt.android.sdk.internal.backend.proto.Exposed.ProtoExposedList.newBuilder() private Builder() { super(DEFAULT_INSTANCE); } /** * <code>int64 batchReleaseTime = 1;</code> * @return The batchReleaseTime. */ @java.lang.Override public long getBatchReleaseTime() { return instance.getBatchReleaseTime(); } /** * <code>int64 batchReleaseTime = 1;</code> * @param value The batchReleaseTime to set. * @return This builder for chaining. */ public Builder setBatchReleaseTime(long value) { copyOnWrite(); instance.setBatchReleaseTime(value); return this; } /** * <code>int64 batchReleaseTime = 1;</code> * @return This builder for chaining. */ public Builder clearBatchReleaseTime() { copyOnWrite(); instance.clearBatchReleaseTime(); return this; } /** * <code>repeated .org.dpppt.android.sdk.internal.backend.proto.ProtoExposee exposed = 2;</code> */ @java.lang.Override public java.util.List<org.dpppt.android.sdk.internal.backend.proto.Exposed.ProtoExposee> getExposedList() { return java.util.Collections.unmodifiableList( instance.getExposedList()); } /** * <code>repeated .org.dpppt.android.sdk.internal.backend.proto.ProtoExposee exposed = 2;</code> */ @java.lang.Override public int getExposedCount() { return instance.getExposedCount(); }/** * <code>repeated .org.dpppt.android.sdk.internal.backend.proto.ProtoExposee exposed = 2;</code> */ @java.lang.Override public org.dpppt.android.sdk.internal.backend.proto.Exposed.ProtoExposee getExposed(int index) { return instance.getExposed(index); } /** * <code>repeated .org.dpppt.android.sdk.internal.backend.proto.ProtoExposee exposed = 2;</code> */ public Builder setExposed( int index, org.dpppt.android.sdk.internal.backend.proto.Exposed.ProtoExposee value) { copyOnWrite(); instance.setExposed(index, value); return this; } /** * <code>repeated .org.dpppt.android.sdk.internal.backend.proto.ProtoExposee exposed = 2;</code> */ public Builder setExposed( int index, org.dpppt.android.sdk.internal.backend.proto.Exposed.ProtoExposee.Builder builderForValue) { copyOnWrite(); instance.setExposed(index, builderForValue.build()); return this; } /** * <code>repeated .org.dpppt.android.sdk.internal.backend.proto.ProtoExposee exposed = 2;</code> */ public Builder addExposed(org.dpppt.android.sdk.internal.backend.proto.Exposed.ProtoExposee value) { copyOnWrite(); instance.addExposed(value); return this; } /** * <code>repeated .org.dpppt.android.sdk.internal.backend.proto.ProtoExposee exposed = 2;</code> */ public Builder addExposed( int index, org.dpppt.android.sdk.internal.backend.proto.Exposed.ProtoExposee value) { copyOnWrite(); instance.addExposed(index, value); return this; } /** * <code>repeated .org.dpppt.android.sdk.internal.backend.proto.ProtoExposee exposed = 2;</code> */ public Builder addExposed( org.dpppt.android.sdk.internal.backend.proto.Exposed.ProtoExposee.Builder builderForValue) { copyOnWrite(); instance.addExposed(builderForValue.build()); return this; } /** * <code>repeated .org.dpppt.android.sdk.internal.backend.proto.ProtoExposee exposed = 2;</code> */ public Builder addExposed( int index, org.dpppt.android.sdk.internal.backend.proto.Exposed.ProtoExposee.Builder builderForValue) { copyOnWrite(); instance.addExposed(index, builderForValue.build()); return this; } /** * <code>repeated .org.dpppt.android.sdk.internal.backend.proto.ProtoExposee exposed = 2;</code> */ public Builder addAllExposed( java.lang.Iterable<? extends org.dpppt.android.sdk.internal.backend.proto.Exposed.ProtoExposee> values) { copyOnWrite(); instance.addAllExposed(values); return this; } /** * <code>repeated .org.dpppt.android.sdk.internal.backend.proto.ProtoExposee exposed = 2;</code> */ public Builder clearExposed() { copyOnWrite(); instance.clearExposed(); return this; } /** * <code>repeated .org.dpppt.android.sdk.internal.backend.proto.ProtoExposee exposed = 2;</code> */ public Builder removeExposed(int index) { copyOnWrite(); instance.removeExposed(index); return this; } // @@protoc_insertion_point(builder_scope:org.dpppt.android.sdk.internal.backend.proto.ProtoExposedList) } @java.lang.Override @java.lang.SuppressWarnings({"unchecked", "fallthrough"}) protected final java.lang.Object dynamicMethod( com.google.protobuf.GeneratedMessageLite.MethodToInvoke method, java.lang.Object arg0, java.lang.Object arg1) { switch (method) { case NEW_MUTABLE_INSTANCE: { return new org.dpppt.android.sdk.internal.backend.proto.Exposed.ProtoExposedList(); } case NEW_BUILDER: { return new Builder(); } case BUILD_MESSAGE_INFO: { java.lang.Object[] objects = new java.lang.Object[] { "batchReleaseTime_", "exposed_", org.dpppt.android.sdk.internal.backend.proto.Exposed.ProtoExposee.class, }; java.lang.String info = "\u0000\u0002\u0000\u0000\u0001\u0002\u0002\u0000\u0001\u0000\u0001\u0002\u0002\u001b" + ""; return newMessageInfo(DEFAULT_INSTANCE, info, objects); } // fall through case GET_DEFAULT_INSTANCE: { return DEFAULT_INSTANCE; } case GET_PARSER: { com.google.protobuf.Parser<org.dpppt.android.sdk.internal.backend.proto.Exposed.ProtoExposedList> parser = PARSER; if (parser == null) { synchronized (org.dpppt.android.sdk.internal.backend.proto.Exposed.ProtoExposedList.class) { parser = PARSER; if (parser == null) { parser = new DefaultInstanceBasedParser<org.dpppt.android.sdk.internal.backend.proto.Exposed.ProtoExposedList>( DEFAULT_INSTANCE); PARSER = parser; } } } return parser; } case GET_MEMOIZED_IS_INITIALIZED: { return (byte) 1; } case SET_MEMOIZED_IS_INITIALIZED: { return null; } } throw new UnsupportedOperationException(); } // @@protoc_insertion_point(class_scope:org.dpppt.android.sdk.internal.backend.proto.ProtoExposedList) private static final org.dpppt.android.sdk.internal.backend.proto.Exposed.ProtoExposedList DEFAULT_INSTANCE; static { ProtoExposedList defaultInstance = new ProtoExposedList(); // New instances are implicitly immutable so no need to make // immutable. DEFAULT_INSTANCE = defaultInstance; com.google.protobuf.GeneratedMessageLite.registerDefaultInstance( ProtoExposedList.class, defaultInstance); } public static org.dpppt.android.sdk.internal.backend.proto.Exposed.ProtoExposedList getDefaultInstance() { return DEFAULT_INSTANCE; } private static volatile com.google.protobuf.Parser<ProtoExposedList> PARSER; public static com.google.protobuf.Parser<ProtoExposedList> parser() { return DEFAULT_INSTANCE.getParserForType(); } } public interface ProtoExposeeOrBuilder extends // @@protoc_insertion_point(interface_extends:org.dpppt.android.sdk.internal.backend.proto.ProtoExposee) com.google.protobuf.MessageLiteOrBuilder { /** * <code>bytes key = 2;</code> * @return The key. */ com.google.protobuf.ByteString getKey(); /** * <code>int64 keyDate = 3;</code> * @return The keyDate. */ long getKeyDate(); } /** * Protobuf type {@code org.dpppt.android.sdk.internal.backend.proto.ProtoExposee} */ public static final class ProtoExposee extends com.google.protobuf.GeneratedMessageLite< ProtoExposee, ProtoExposee.Builder> implements // @@protoc_insertion_point(message_implements:org.dpppt.android.sdk.internal.backend.proto.ProtoExposee) ProtoExposeeOrBuilder { private ProtoExposee() { key_ = com.google.protobuf.ByteString.EMPTY; } public static final int KEY_FIELD_NUMBER = 2; private com.google.protobuf.ByteString key_; /** * <code>bytes key = 2;</code> * @return The key. */ @java.lang.Override public com.google.protobuf.ByteString getKey() { return key_; } /** * <code>bytes key = 2;</code> * @param value The key to set. */ private void setKey(com.google.protobuf.ByteString value) { value.getClass(); key_ = value; } /** * <code>bytes key = 2;</code> */ private void clearKey() { key_ = getDefaultInstance().getKey(); } public static final int KEYDATE_FIELD_NUMBER = 3; private long keyDate_; /** * <code>int64 keyDate = 3;</code> * @return The keyDate. */ @java.lang.Override public long getKeyDate() { return keyDate_; } /** * <code>int64 keyDate = 3;</code> * @param value The keyDate to set. */ private void setKeyDate(long value) { keyDate_ = value; } /** * <code>int64 keyDate = 3;</code> */ private void clearKeyDate() { keyDate_ = 0L; } public static org.dpppt.android.sdk.internal.backend.proto.Exposed.ProtoExposee parseFrom( java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { return com.google.protobuf.GeneratedMessageLite.parseFrom( DEFAULT_INSTANCE, data); } public static org.dpppt.android.sdk.internal.backend.proto.Exposed.ProtoExposee parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return com.google.protobuf.GeneratedMessageLite.parseFrom( DEFAULT_INSTANCE, data, extensionRegistry); } public static org.dpppt.android.sdk.internal.backend.proto.Exposed.ProtoExposee parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return com.google.protobuf.GeneratedMessageLite.parseFrom( DEFAULT_INSTANCE, data); } public static org.dpppt.android.sdk.internal.backend.proto.Exposed.ProtoExposee parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return com.google.protobuf.GeneratedMessageLite.parseFrom( DEFAULT_INSTANCE, data, extensionRegistry); } public static org.dpppt.android.sdk.internal.backend.proto.Exposed.ProtoExposee parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return com.google.protobuf.GeneratedMessageLite.parseFrom( DEFAULT_INSTANCE, data); } public static org.dpppt.android.sdk.internal.backend.proto.Exposed.ProtoExposee parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return com.google.protobuf.GeneratedMessageLite.parseFrom( DEFAULT_INSTANCE, data, extensionRegistry); } public static org.dpppt.android.sdk.internal.backend.proto.Exposed.ProtoExposee parseFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageLite.parseFrom( DEFAULT_INSTANCE, input); } public static org.dpppt.android.sdk.internal.backend.proto.Exposed.ProtoExposee parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageLite.parseFrom( DEFAULT_INSTANCE, input, extensionRegistry); } public static org.dpppt.android.sdk.internal.backend.proto.Exposed.ProtoExposee parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return parseDelimitedFrom(DEFAULT_INSTANCE, input); } public static org.dpppt.android.sdk.internal.backend.proto.Exposed.ProtoExposee parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return parseDelimitedFrom(DEFAULT_INSTANCE, input, extensionRegistry); } public static org.dpppt.android.sdk.internal.backend.proto.Exposed.ProtoExposee parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageLite.parseFrom( DEFAULT_INSTANCE, input); } public static org.dpppt.android.sdk.internal.backend.proto.Exposed.ProtoExposee parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageLite.parseFrom( DEFAULT_INSTANCE, input, extensionRegistry); } public static Builder newBuilder() { return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(org.dpppt.android.sdk.internal.backend.proto.Exposed.ProtoExposee prototype) { return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); } /** * Protobuf type {@code org.dpppt.android.sdk.internal.backend.proto.ProtoExposee} */ public static final class Builder extends com.google.protobuf.GeneratedMessageLite.Builder< org.dpppt.android.sdk.internal.backend.proto.Exposed.ProtoExposee, Builder> implements // @@protoc_insertion_point(builder_implements:org.dpppt.android.sdk.internal.backend.proto.ProtoExposee) org.dpppt.android.sdk.internal.backend.proto.Exposed.ProtoExposeeOrBuilder { // Construct using org.dpppt.android.sdk.internal.backend.proto.Exposed.ProtoExposee.newBuilder() private Builder() { super(DEFAULT_INSTANCE); } /** * <code>bytes key = 2;</code> * @return The key. */ @java.lang.Override public com.google.protobuf.ByteString getKey() { return instance.getKey(); } /** * <code>bytes key = 2;</code> * @param value The key to set. * @return This builder for chaining. */ public Builder setKey(com.google.protobuf.ByteString value) { copyOnWrite(); instance.setKey(value); return this; } /** * <code>bytes key = 2;</code> * @return This builder for chaining. */ public Builder clearKey() { copyOnWrite(); instance.clearKey(); return this; } /** * <code>int64 keyDate = 3;</code> * @return The keyDate. */ @java.lang.Override public long getKeyDate() { return instance.getKeyDate(); } /** * <code>int64 keyDate = 3;</code> * @param value The keyDate to set. * @return This builder for chaining. */ public Builder setKeyDate(long value) { copyOnWrite(); instance.setKeyDate(value); return this; } /** * <code>int64 keyDate = 3;</code> * @return This builder for chaining. */ public Builder clearKeyDate() { copyOnWrite(); instance.clearKeyDate(); return this; } // @@protoc_insertion_point(builder_scope:org.dpppt.android.sdk.internal.backend.proto.ProtoExposee) } @java.lang.Override @java.lang.SuppressWarnings({"unchecked", "fallthrough"}) protected final java.lang.Object dynamicMethod( com.google.protobuf.GeneratedMessageLite.MethodToInvoke method, java.lang.Object arg0, java.lang.Object arg1) { switch (method) { case NEW_MUTABLE_INSTANCE: { return new org.dpppt.android.sdk.internal.backend.proto.Exposed.ProtoExposee(); } case NEW_BUILDER: { return new Builder(); } case BUILD_MESSAGE_INFO: { java.lang.Object[] objects = new java.lang.Object[] { "key_", "keyDate_", }; java.lang.String info = "\u0000\u0002\u0000\u0000\u0002\u0003\u0002\u0000\u0000\u0000\u0002\n\u0003\u0002" + ""; return newMessageInfo(DEFAULT_INSTANCE, info, objects); } // fall through case GET_DEFAULT_INSTANCE: { return DEFAULT_INSTANCE; } case GET_PARSER: { com.google.protobuf.Parser<org.dpppt.android.sdk.internal.backend.proto.Exposed.ProtoExposee> parser = PARSER; if (parser == null) { synchronized (org.dpppt.android.sdk.internal.backend.proto.Exposed.ProtoExposee.class) { parser = PARSER; if (parser == null) { parser = new DefaultInstanceBasedParser<org.dpppt.android.sdk.internal.backend.proto.Exposed.ProtoExposee>( DEFAULT_INSTANCE); PARSER = parser; } } } return parser; } case GET_MEMOIZED_IS_INITIALIZED: { return (byte) 1; } case SET_MEMOIZED_IS_INITIALIZED: { return null; } } throw new UnsupportedOperationException(); } // @@protoc_insertion_point(class_scope:org.dpppt.android.sdk.internal.backend.proto.ProtoExposee) private static final org.dpppt.android.sdk.internal.backend.proto.Exposed.ProtoExposee DEFAULT_INSTANCE; static { ProtoExposee defaultInstance = new ProtoExposee(); // New instances are implicitly immutable so no need to make // immutable. DEFAULT_INSTANCE = defaultInstance; com.google.protobuf.GeneratedMessageLite.registerDefaultInstance( ProtoExposee.class, defaultInstance); } public static org.dpppt.android.sdk.internal.backend.proto.Exposed.ProtoExposee getDefaultInstance() { return DEFAULT_INSTANCE; } private static volatile com.google.protobuf.Parser<ProtoExposee> PARSER; public static com.google.protobuf.Parser<ProtoExposee> parser() { return DEFAULT_INSTANCE.getParserForType(); } } static { } // @@protoc_insertion_point(outer_class_scope) }
import { SubscribeMessage, WebSocketGateway, WebSocketServer, WsResponse } from '@nestjs/websockets' import { Server, Socket } from 'socket.io' import { StartGameData } from 'src/dto/data/start-game.data' import { SelectWordPayload } from 'src/dto/payload/select-word.payload' import { Room } from 'src/models/room.model' import { GameService } from 'src/services/game.service' import { START_GAME, WORD_SELECT } from 'src/util/events' @WebSocketGateway() export class GameGateway { @WebSocketServer() server: Server private rooms: Map<string, Room> = new Map<string, Room>() constructor(private readonly gameService: GameService) {} @SubscribeMessage('startGame') handleStartGame(client: Socket, data: StartGameData): void { const room = this.getRoomForClient(client) if (room) { // Notify all clients in the room to start the game this.server.to(room.id).emit(START_GAME, data) } } @SubscribeMessage('selectWord') handleSelectWord(client: Socket, payload: SelectWordPayload): void { const room = this.getRoomForClient(client) if (room) { // Handle word selection logic and notify all clients in the room about the selected word this.server.to(room.id).emit(WORD_SELECT, payload) } } private getRoomForClient(client: Socket): Room | undefined { for (const [roomId, room] of this.rooms) { if (room.clients.has(client.id)) { return room } } return undefined } }
DROP TABLE IF EXISTS folio_reporting.holdings_statements_supplements; -- This table contains holdings statements for supplements with their -- associated public/staff only notes; regular holdings statements and -- holdings statements for indexes are in separate tables. Here note is a public note. CREATE TABLE folio_reporting.holdings_statements_supplements AS SELECT holdings.id AS holdings_id, holdings.hrid AS holdings_hrid, json_extract_path_text(holdings_statements_for_supplements.data, 'statement') AS "statement", json_extract_path_text(holdings_statements_for_supplements.data, 'note') AS public_note, json_extract_path_text(holdings_statements_for_supplements.data, 'staffNote') AS staff_note FROM inventory_holdings AS holdings CROSS JOIN json_array_elements(json_extract_path(data, 'holdingsStatementsForSupplements')) AS holdings_statements_for_supplements(data); CREATE INDEX ON folio_reporting.holdings_statements_supplements (holdings_id); CREATE INDEX ON folio_reporting.holdings_statements_supplements (holdings_hrid); CREATE INDEX ON folio_reporting.holdings_statements_supplements ("statement"); CREATE INDEX ON folio_reporting.holdings_statements_supplements (public_note); CREATE INDEX ON folio_reporting.holdings_statements_supplements (staff_note);
package com.zhcs.entity; import java.io.Serializable; import java.util.Date; //***************************************************************************** /** * <p>Title:AuditscheduleEntity</p> * <p>Description: 审核进度</p> * <p>Copyright: Copyright (c) 2017</p> * <p>Company: 深圳市智慧城市管家信息科技有限公司 </p> * @author 刘晓东 - Alter * @version v1.0 2017年2月23日 */ //***************************************************************************** public class AuditscheduleEntity implements Serializable { private static final long serialVersionUID = 1L; //主键id private Long id; //预算申报 private Long budget; //审核人 private Long person; //补充说明 private String rmk; //当前进度 private Integer schedule; //是否通过 private Integer pass; //创建人员 private Long crtid; //创建时间 private Date crttm; //修改人员 private Long updid; //修改时间 private Date updtm; /** * 设置:主键id */ public void setId(Long id) { this.id = id; } /** * 获取:主键id */ public Long getId() { return id; } /** * 设置:预算申报 */ public void setBudget(Long budget) { this.budget = budget; } /** * 获取:预算申报 */ public Long getBudget() { return budget; } /** * 设置:审核人 */ public void setPerson(Long person) { this.person = person; } /** * 获取:审核人 */ public Long getPerson() { return person; } /** * 设置:补充说明 */ public void setRmk(String rmk) { this.rmk = rmk; } /** * 获取:补充说明 */ public String getRmk() { return rmk; } /** * 设置:当前进度 */ public void setSchedule(Integer schedule) { this.schedule = schedule; } /** * 获取:当前进度 */ public Integer getSchedule() { return schedule; } /** * 设置:创建人员 */ public void setCrtid(Long crtid) { this.crtid = crtid; } /** * 获取:创建人员 */ public Long getCrtid() { return crtid; } /** * 设置:创建时间 */ public void setCrttm(Date crttm) { this.crttm = crttm; } /** * 获取:创建时间 */ public Date getCrttm() { return crttm; } /** * 设置:修改人员 */ public void setUpdid(Long updid) { this.updid = updid; } /** * 获取:修改人员 */ public Long getUpdid() { return updid; } /** * 设置:修改时间 */ public void setUpdtm(Date updtm) { this.updtm = updtm; } /** * 获取:修改时间 */ public Date getUpdtm() { return updtm; } public Integer getPass() { return pass; } public void setPass(Integer pass) { this.pass = pass; } }
package com.createchance.imageeditor.drawers; import android.graphics.Bitmap; import android.opengl.GLES20; import android.opengl.Matrix; import com.createchance.imageeditor.freetype.FreeType; import com.createchance.imageeditor.shaders.ModelViewVertexShader; import com.createchance.imageeditor.shaders.TextFragmentShader; import com.createchance.imageeditor.utils.Logger; import com.createchance.imageeditor.utils.OpenGlUtils; import java.nio.FloatBuffer; import java.util.ArrayList; import java.util.List; import static android.opengl.GLES20.GL_BLEND; import static android.opengl.GLES20.glDeleteProgram; import static android.opengl.GLES20.glDrawArrays; /** * Draw text texture to image. * * @author createchance * @date 2018-10-08 */ public class TextDrawer extends AbstractDrawer { private static final String TAG = "TextDrawer"; private FloatBuffer mVertexPositionBuffer; private FloatBuffer mTextureCoordinateBuffer; private List<LoadedText> mLoadedTextList; private ModelViewVertexShader mVertexShader; private TextFragmentShader mFragmentShader; private int mBackgroundTextureId = -1; private float[] mModelMatrix, mViewMatrix, mProjectionMatrix; public TextDrawer() { mVertexShader = new ModelViewVertexShader(); mFragmentShader = new TextFragmentShader(); loadProgram(mVertexShader.getShaderId(), mFragmentShader.getShaderId()); mVertexShader.initLocation(mProgramId); mFragmentShader.initLocation(mProgramId); mLoadedTextList = new ArrayList<>(); mVertexPositionBuffer = createFloatBuffer( new float[]{ -1.0f, 1.0f, -1.0f, -1.0f, 1.0f, 1.0f, 1.0f, -1.0f, } ); mTextureCoordinateBuffer = createFloatBuffer( new float[]{ 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, } ); mModelMatrix = new float[16]; mViewMatrix = new float[16]; mProjectionMatrix = new float[16]; Matrix.setIdentityM(mModelMatrix, 0); Matrix.setIdentityM(mViewMatrix, 0); Matrix.setIdentityM(mProjectionMatrix, 0); } public void setText(String fontPath, String text, int textSize) { char[] textArray = text.toCharArray(); int[] unicodeTextArray = new int[textArray.length]; mLoadedTextList.clear(); for (int i = 0; i < textArray.length; i++) { mLoadedTextList.add(new LoadedText(textArray[i])); unicodeTextArray[i] = textArray[i]; } int[] result = FreeType.loadText(fontPath, unicodeTextArray, textSize); for (int i = 0, j = 0; i < result.length; i += 7) { LoadedText loadedText = mLoadedTextList.get(j++); loadedText.textureId = result[i]; loadedText.width = result[i + 1]; loadedText.height = result[i + 2]; loadedText.left = result[i + 3]; loadedText.top = result[i + 4]; loadedText.advanceX = result[i + 5]; loadedText.advanceY = result[i + 6]; } } public void setTextColor(float red, float green, float blue) { GLES20.glUseProgram(mProgramId); mFragmentShader.setUUseBackground(false); if (mBackgroundTextureId != -1) { GLES20.glDeleteTextures(0, new int[]{mBackgroundTextureId}, 0); mBackgroundTextureId = -1; } mFragmentShader.setUTextColor(red, green, blue); } public void setTextAlpha(float alphaFactor) { GLES20.glUseProgram(mProgramId); mFragmentShader.setUAlphaFactor(alphaFactor); } public void setTextBackground(Bitmap background) { GLES20.glUseProgram(mProgramId); if (background != null) { mFragmentShader.setUUseBackground(true); mBackgroundTextureId = OpenGlUtils.loadTexture(background, OpenGlUtils.NO_TEXTURE, true); } else { Logger.e(TAG, "Text background set failed, background can not be null!"); } } public void draw(int posX, int posY) { GLES20.glUseProgram(mProgramId); GLES20.glEnable(GL_BLEND); GLES20.glBlendFuncSeparate(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE_MINUS_SRC_ALPHA, GLES20.GL_ONE, GLES20.GL_ONE); int currentPosX = posX; for (LoadedText loadedText : mLoadedTextList) { int xpos = currentPosX + loadedText.left; int ypos = posY - (loadedText.height - loadedText.top); int w = loadedText.width; int h = loadedText.height; GLES20.glViewport(xpos, ypos, w, h); GLES20.glClearColor(0, 0, 0, 1); mFragmentShader.setUInputTexture(GLES20.GL_TEXTURE0, loadedText.textureId); mVertexShader.setAPosition(mVertexPositionBuffer); mVertexShader.setATextureCoordinates(mTextureCoordinateBuffer); mVertexShader.setUModelMatrix(mModelMatrix); mVertexShader.setUViewMatrix(mViewMatrix); mVertexShader.setUProjectionMatrix(mProjectionMatrix); // draw text GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4); // draw background if need if (mBackgroundTextureId != -1) { mFragmentShader.setUBackground(GLES20.GL_TEXTURE3, mBackgroundTextureId); glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4); } mVertexShader.unsetAPosition(); mVertexShader.unsetATextureCoordinates(); currentPosX += loadedText.advanceX >> 6; } GLES20.glDisable(GL_BLEND); } public void release() { glDeleteProgram(mProgramId); } public int getWidth() { int width = 0; int currentPosX = 0; for (LoadedText loadedText : mLoadedTextList) { width = currentPosX + loadedText.left; currentPosX += loadedText.advanceX >> 6; } width += mLoadedTextList.get(mLoadedTextList.size() - 1).width + mLoadedTextList.get(mLoadedTextList.size() - 1).left; return width; } public int getHeight() { int height = 0; for (LoadedText loadedText : mLoadedTextList) { if (loadedText.height > height) { height = loadedText.height; } } return height; } private class LoadedText { public int value; public int textureId; public int width; public int height; public int left; public int top; public int advanceX; public int advanceY; public LoadedText(int value) { this.value = value; } } }
const swipeableViewStyles = (theme) => ({ root: { backgroundColor: theme.palette.background.paper } }); export default swipeableViewStyles;
dataset=20newsgroup data_path="data/20news.json" n_train_class=8 n_val_class=5 n_test_class=7 if [ "$dataset" = "fewrel" ]; then python src/main.py \ --cuda 0 \ --way 5 \ --shot 1 \ --query 25 \ --mode train \ --embedding meta \ --classifier r2d2 \ --dataset=$dataset \ --data_path=$data_path \ --n_train_class=$n_train_class \ --n_val_class=$n_val_class \ --n_test_class=$n_test_class \ --auxiliary pos \ --meta_iwf \ --meta_w_target else python src/main.py \ --cuda 0 \ --way 5 \ --shot 3 \ --query 25 \ --mode train \ --embedding meta \ --classifier r2d2 \ --dataset=$dataset \ --data_path=$data_path \ --n_train_class=$n_train_class \ --n_val_class=$n_val_class \ --n_test_class=$n_test_class \ --name 20news_high_shot \ --train_shots 10 \ --meta_iwf \ --meta_w_target fi
package ru.progrm_jarvis.javacommons.collection.concurrent; import lombok.NonNull; import javax.annotation.Nonnull; import java.util.Collection; import java.util.Iterator; import java.util.Spliterator; import java.util.function.Consumer; import java.util.function.Predicate; import java.util.stream.Stream; public class ConcurrentCollectionWrapper<E, T extends Collection<E>> extends ConcurrentWrapper<T> implements Collection<E> { public ConcurrentCollectionWrapper(@NonNull final T wrapped) { super(wrapped); } @Override public int size() { readLock.lock(); try { return wrapped.size(); } finally { readLock.unlock(); } } @Override public boolean isEmpty() { readLock.lock(); try { return wrapped.isEmpty(); } finally { readLock.unlock(); } } @Override public boolean contains(final Object o) { readLock.lock(); try { return wrapped.contains(o); } finally { readLock.unlock(); } } @Override @Nonnull public Iterator<E> iterator() { readLock.lock(); try { return wrapped.iterator(); } finally { readLock.unlock(); } } @Override public void forEach(@NonNull final Consumer<? super E> action) { readLock.lock(); try { wrapped.forEach(action); } finally { readLock.unlock(); } } @Override @Nonnull public Object[] toArray() { readLock.lock(); try { return wrapped.toArray(); } finally { readLock.unlock(); } } @Override @Nonnull public <R> R[] toArray(@NonNull final R[] a) { readLock.lock(); try { //noinspection SuspiciousToArrayCall return wrapped.toArray(a); } finally { readLock.unlock(); } } @Override public boolean add(final E e) { writeLock.lock(); try { return wrapped.add(e); } finally { writeLock.unlock(); } } @Override public boolean remove(final Object o) { writeLock.lock(); try { return wrapped.remove(o); } finally { writeLock.unlock(); } } @Override public boolean containsAll(@NonNull final Collection<?> c) { readLock.lock(); try { return wrapped.containsAll(c); } finally { readLock.unlock(); } } @Override public boolean addAll(@NonNull final Collection<? extends E> c) { writeLock.lock(); try { return wrapped.addAll(c); } finally { writeLock.unlock(); } } @Override public boolean retainAll(@NonNull final Collection<?> c) { writeLock.lock(); try { return wrapped.retainAll(c); } finally { writeLock.unlock(); } } @Override public boolean removeAll(@NonNull final Collection<?> c) { writeLock.lock(); try { return wrapped.removeAll(c); } finally { writeLock.unlock(); } } @Override public boolean removeIf(@NonNull final Predicate<? super E> filter) { writeLock.lock(); try { return wrapped.removeIf(filter); } finally { writeLock.unlock(); } } @Override public void clear() { writeLock.lock(); try { wrapped.clear(); } finally { writeLock.unlock(); } } @Override public Spliterator<E> spliterator() { readLock.lock(); try { return wrapped.spliterator(); } finally { readLock.unlock(); } } @Override public Stream<E> stream() { readLock.lock(); try { return wrapped.stream(); } finally { readLock.unlock(); } } @Override public Stream<E> parallelStream() { readLock.lock(); try { return wrapped.parallelStream(); } finally { readLock.unlock(); } } }
/* * Copyright 2002 Sun Microsystems, Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * - Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * - Redistribution in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * Neither the name of Sun Microsystems, Inc. or the names of * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * This software is provided "AS IS," without a warranty of any * kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY * EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR * DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN * OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR * FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE SOFTWARE, * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. * * You acknowledge that Software is not designed, licensed or intended * for use in the design, construction, operation or maintenance of * any nuclear facility. */ package com.sun.j2ee.blueprints.cart.model; import java.io.Serializable; import java.util.Iterator; import java.util.Collection; import com.sun.j2ee.blueprints.util.tracer.Debug; /** * This class represents the model data for the shopping cart. * It is a value object and has fine grained getter methods. */ public class ShoppingCartModel implements Serializable { private Collection items; public ShoppingCartModel(Collection items) { this.items = items; } /** * Class constructor with no arguments, used by the web tier. */ public ShoppingCartModel() {} public int getSize() { if (items != null) return items.size(); else return 0; } /** @return an collection of all the CartItems. */ public Collection getCart() { return items; } /** @return an iterator over all the CartItems. */ public Iterator getItems() { return items.iterator(); } public double getTotalCost() { double total = 0; for (Iterator li = getItems(); li.hasNext(); ) { CartItem item = (CartItem) li.next(); total += item.getTotalCost(); } return total; } /** * copies over the data from the specified shopping cart. Note * that it is a shallow copy. */ public void copy(ShoppingCartModel src) { this.items = src.items; } }
<reponame>Sasha7b9Work/S8-53M2<filename>sources/VS/ThirdParty/wxWidgets/src/qt/sockqt.cpp /////////////////////////////////////////////////////////////////////////////// // Name: src/qt/sockqt.cpp // Purpose: implementation of wxQT-specific socket event handling // Author: <NAME> // Copyright: (c) 2014 wxWidgets dev team // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" #if wxUSE_SOCKETS #include "wx/apptrait.h" #include "wx/log.h" #include "wx/private/fdiomanager.h" #include <QtCore/QSocketNotifier> class wxQtFDIONotifier : public QSocketNotifier { public: wxQtFDIONotifier(int fd, QSocketNotifier::Type type, wxFDIOHandler *handler) : QSocketNotifier(fd, type), m_handler(handler) { setEnabled(true); connect(this, &QSocketNotifier::activated, this, &wxQtFDIONotifier::activated); } wxFDIOHandler *handler() { return m_handler; } void activated() { switch (type()) { case QSocketNotifier::Read: m_handler->OnReadWaiting(); break; case QSocketNotifier::Write: m_handler->OnWriteWaiting(); break; case QSocketNotifier::Exception: //m_handler->OnExceptionWaiting(); break; } } wxFDIOHandler *m_handler; }; class QtFDIOManager : public wxFDIOManager { public: virtual int AddInput(wxFDIOHandler *handler, int fd, Direction d) wxOVERRIDE { QSocketNotifier::Type type; switch (d) { case INPUT: type = QSocketNotifier::Read; break; case OUTPUT: type = QSocketNotifier::Write; break; } m_qtNotifiers.insert(m_qtNotifiers.end(), new wxQtFDIONotifier(fd, type, handler)); handler->SetRegisteredEvent(d); return fd; } virtual void RemoveInput(wxFDIOHandler* handler, int fd, Direction d) wxOVERRIDE { QSocketNotifier::Type type = d == INPUT ? QSocketNotifier::Read : QSocketNotifier::Write; for ( wxVector<wxQtFDIONotifier*>::iterator it = m_qtNotifiers.begin(); it != m_qtNotifiers.end(); ++it ) { wxQtFDIONotifier* notifier = static_cast<wxQtFDIONotifier*>(*it); if ( (notifier->socket() == fd) && (notifier->handler() == handler) && (notifier->type() == type) ) { delete notifier; m_qtNotifiers.erase(it); break; } } } wxVector<wxQtFDIONotifier*> m_qtNotifiers; }; #if defined(__UNIX__) wxFDIOManager *wxGUIAppTraits::GetFDIOManager() { static QtFDIOManager s_manager; return &s_manager; } #endif // __UNIX__ #endif // wxUSE_SOCKETS
/* Copyright 2021 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package noderesourcetopology import ( "context" "fmt" "strings" v1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" "k8s.io/klog/v2" v1qos "k8s.io/kubernetes/pkg/apis/core/v1/helper/qos" bm "k8s.io/kubernetes/pkg/kubelet/cm/topologymanager/bitmask" "k8s.io/kubernetes/pkg/scheduler/framework" topologyv1alpha1 "github.com/k8stopologyawareschedwg/noderesourcetopology-api/pkg/apis/topology/v1alpha1" "sigs.k8s.io/scheduler-plugins/pkg/util" ) type PolicyHandler func(pod *v1.Pod, zoneMap topologyv1alpha1.ZoneList) *framework.Status func singleNUMAContainerLevelHandler(pod *v1.Pod, zones topologyv1alpha1.ZoneList, nodeInfo *framework.NodeInfo) *framework.Status { klog.V(5).InfoS("Single NUMA node handler") // prepare NUMANodes list from zoneMap nodes := createNUMANodeList(zones) qos := v1qos.GetPodQOS(pod) // We count here in the way TopologyManager is doing it, IOW we put InitContainers // and normal containers in the one scope for _, container := range append(pod.Spec.InitContainers, pod.Spec.Containers...) { if resMatchNUMANodes(nodes, container.Resources.Requests, qos, nodeInfo) { // definitely we can't align container, so we can't align a pod return framework.NewStatus(framework.Unschedulable, fmt.Sprintf("cannot align container: %s", container.Name)) } } return nil } // resMatchNUMANodes checks for sufficient resource, this function // requires NUMANodeList with properly populated NUMANode, NUMAID should be in range 0-63 func resMatchNUMANodes(numaNodes NUMANodeList, resources v1.ResourceList, qos v1.PodQOSClass, nodeInfo *framework.NodeInfo) bool { bitmask := bm.NewEmptyBitMask() // set all bits, each bit is a NUMA node, if resources couldn't be aligned // on the NUMA node, bit should be unset bitmask.Fill() zeroQuantity := resource.MustParse("0") for resource, quantity := range resources { // for each requested resource, calculate which NUMA slots are good fits, and then AND with the aggregated bitmask, IOW unset appropriate bit if we can't align resources, or set it // obvious, bits which are not in the NUMA id's range would be unset resourceBitmask := bm.NewEmptyBitMask() for _, numaNode := range numaNodes { numaQuantity, ok := numaNode.Resources[resource] // if the requested resource can't be found on the NUMA node, we still need to check // if the resource can be found at the node itself, because there are resources which are not NUMA aligned // or not supported by the topology exporter - if resource was not found at both checks - skip (don't set it as available NUMA node). // if the un-found resource has 0 quantity probably this numa node can be considered. if !ok && !resourceFoundOnNode(resource, quantity, nodeInfo) && quantity.Cmp(zeroQuantity) != 0 { continue } // Check for the following: // 1. set numa node as possible node if resource is memory or Hugepages // 2. set numa node as possible node if resource is cpu and it's not guaranteed QoS, since cpu will flow // 3. set numa node as possible node if zero quantity for non existing resource was requested // 4. otherwise check amount of resources if resource == v1.ResourceMemory || strings.HasPrefix(string(resource), v1.ResourceHugePagesPrefix) || resource == v1.ResourceCPU && qos != v1.PodQOSGuaranteed || quantity.Cmp(zeroQuantity) == 0 || numaQuantity.Cmp(quantity) >= 0 { // possible to align resources on NUMA node resourceBitmask.Add(numaNode.NUMAID) } } bitmask.And(resourceBitmask) if bitmask.IsEmpty() { return true } } return bitmask.IsEmpty() } func singleNUMAPodLevelHandler(pod *v1.Pod, zones topologyv1alpha1.ZoneList, nodeInfo *framework.NodeInfo) *framework.Status { klog.V(5).InfoS("Pod Level Resource handler") resources := util.GetPodEffectiveRequest(pod) if resMatchNUMANodes(createNUMANodeList(zones), resources, v1qos.GetPodQOS(pod), nodeInfo) { // definitely we can't align container, so we can't align a pod return framework.NewStatus(framework.Unschedulable, fmt.Sprintf("cannot align pod: %s", pod.Name)) } return nil } // Filter Now only single-numa-node supported func (tm *TopologyMatch) Filter(ctx context.Context, cycleState *framework.CycleState, pod *v1.Pod, nodeInfo *framework.NodeInfo) *framework.Status { if nodeInfo.Node() == nil { return framework.NewStatus(framework.Error, "node not found") } if v1qos.GetPodQOS(pod) == v1.PodQOSBestEffort { return nil } nodeName := nodeInfo.Node().Name nodeTopology := findNodeTopology(nodeName, tm.lister) if nodeTopology == nil { return nil } klog.V(5).InfoS("Found NodeResourceTopology", "nodeTopology", klog.KObj(nodeTopology)) for _, policyName := range nodeTopology.TopologyPolicies { if handler, ok := tm.policyHandlers[topologyv1alpha1.TopologyManagerPolicy(policyName)]; ok { if status := handler.filter(pod, nodeTopology.Zones, nodeInfo); status != nil { return status } } else { klog.V(5).InfoS("Policy handler not found", "policy", policyName) } } return nil } // resourceFoundOnNode checks whether a given resource exist at the node level // and whether the given quantity is big enough func resourceFoundOnNode(resName v1.ResourceName, wantQuantity resource.Quantity, nodeInfo *framework.NodeInfo) bool { resourceList := util.ResourceList(nodeInfo.Allocatable) if gotQuantity, ok := resourceList[resName]; ok { return gotQuantity.Cmp(wantQuantity) >= 0 } return false }
const request = require('request'); function getWebsiteContent(url) { request(url, function(err, resp, body) { if (err) { console.log('Error retrieving website.'); } else { console.log(body); } }); } getWebsiteContent('https://www.example.com');
#!/bin/bash set -eu source shared.sh target="x86_64-fortanix-unknown-sgx" install_prereq() { curl https://apt.llvm.org/llvm-snapshot.gpg.key|apt-key add - add-apt-repository -y 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-11 main' apt-get update apt-get install -y --no-install-recommends \ build-essential \ ca-certificates \ cmake \ git \ clang-11 } hide_output install_prereq
<gh_stars>0 /* * Copyright 2015 lixiaobo * * VersionUpgrade project licenses this file to you under the Apache License, * version 2.0 (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at: * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ package com.versionmaintain.files; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.util.List; import java.util.Map; import com.cats.utils.IOUtils; import com.cats.version.VersionInfo; /** * @author xiaobolx * 2016年1月21日 */ public class VersionBinFile extends IVersionInfoFile { public VersionBinFile(File file) { super(file); } @SuppressWarnings("unchecked") @Override public boolean loadFile() { if(null == file || !file.exists()) { return false; } FileInputStream fis = null; ObjectInputStream ois = null; boolean loadSucc = true; try { fis = new FileInputStream(file); ois = new ObjectInputStream(fis); data = (Map<String, List<VersionInfo>>)ois.readObject(); } catch (FileNotFoundException e) { e.printStackTrace(); loadSucc = false; } catch (ClassNotFoundException e) { e.printStackTrace(); loadSucc = false; } catch (IOException e) { e.printStackTrace(); loadSucc = false; }catch(Exception e) { e.printStackTrace(); loadSucc = false; }finally { IOUtils.closeResource(fis); IOUtils.closeResource(ois); } return loadSucc; } @Override public boolean saveData() { if(null == file || !file.exists()) { return false; } FileOutputStream fos = null; ObjectOutputStream oos = null; boolean saveSucc = true; try { fos = new FileOutputStream(file); oos = new ObjectOutputStream(fos); oos.writeObject(data); } catch (Exception e) { e.printStackTrace(); saveSucc = false; }finally { IOUtils.closeResource(fos); IOUtils.closeResource(oos); } return saveSucc; } }
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.sshd.git; import java.io.IOException; import java.nio.file.FileSystem; import java.nio.file.Path; import java.util.Objects; import org.apache.sshd.server.session.ServerSession; /** * Used by the GIT command(s) to resolve the root directory of the GIT repository * * @author <a href="mailto:<EMAIL>">Apache MINA SSHD Project</a> */ public interface GitLocationResolver { /** * @param command The complete received command * @param args The command split into arguments - {@code args[0]} is the &quot;pure&quot; command itself * without any other arguments. <B>Note:</B> changing the content of the arguments array may * affect command execution in undetermined ways, due to invocation code changes without prior * notice, so <U>highly recommended to avoid it</U>. * @param session The {@link ServerSession} through which the command was received * @param fs The {@link FileSystem} associated with the server session * @return The local GIT repository root path * @throws IOException If failed to resolve */ Path resolveRootDirectory(String command, String[] args, ServerSession session, FileSystem fs) throws IOException; /** * Creates a resolver that returns the same root directory for any invocation of * {@link #resolveRootDirectory(String, String[], ServerSession, FileSystem) resolveRootDirectory} * * @param rootDir The (never {@code null}) root directory to return * @return The wrapper resolver */ static GitLocationResolver constantPath(Path rootDir) { Objects.requireNonNull(rootDir, "No root directory provided"); return (cmd, args, session, fs) -> rootDir; } }
export enum RequestType { THEATER = "THEATER", } export enum TheaterCode { YONGSAN = "0013", WANGSIMNI = "0074", YEONGDEUNGPO = "0059", CHEONHO = "0199", HONGDAE = "0191", } export enum RankType { MOVIE = "MOVIE", }
#!/bin/bash # Use this script to create a policy exemption for testing purpose. # Reference: https://azsec.azurewebsites.net/2021/12/22/notes-on-azure-policy-exemption/ # The following script is used to create an exemption for the storage account named jpstoragedata. date=$(date +%F-%H%M%SD) policy_exemption_name="storage-exemption-${date}" policy_exemption_desc="This storage account is approved to allow publicAccess temporarily" policy_exemption_displayname="Storage account exemption - ${date}" policy_exemption_category="waiver" expire_on="2021-12-23T00:00:00" policy_exemption_metadata=("RequestedBy=ts" "ApprovedBy=azsec" "ApprovedOn=12/21/2021" "TicketRef=123456789") policy_assignment="/subscriptions/67d6179d-a99d-4ccd-8c56-4d3ff2e13349/providers/Microsoft.Authorization/policyAssignments/2ca44c27185a4776ab0a5016" # policy definition reference id is only needed for policy initiative policy_definition_reference_id="" policy_exemption_scope="/subscriptions/67d6179d-a99d-4ccd-8c56-4d3ff2e13349/resourceGroups/azsec-corporate-rg/providers/Microsoft.Storage/storageAccounts/jpstoragedata" az policy exemption create --name "${policy_exemption_name}" \ --description "${policy_exemption_desc}" \ --display-name "${policy_exemption_displayname}" \ --exemption-category "${policy_exemption_category}" \ --expires-on "${expire_on}" \ --metadata "${policy_exemption_metadata[@]}" \ --policy-assignment "${policy_assignment}" \ --scope "${policy_exemption_scope}"
#!/bin/bash echo "This is the Chromosome 4 finder script" grep '^Chr2' data/genes.bed > data/chr4.bed wc -l data/chr4.bed