This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
give an array n and integer k, for each element in the array, you have to whether +k or -k | |
try to find the minimum gap between the largest value and smallest value after the operations | |
""" | |
def find1(arr, k): | |
arr2 = [] | |
for i in xrange(0, len(arr)): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package(default_visibility = ["//visibility:public"]) | |
cc_proto_library( | |
name = "builtin_service_cc_proto", | |
deps = [":builtin_service_proto"], | |
) | |
proto_library( | |
name = "builtin_service_proto", | |
srcs = ["braft/builtin_service.proto"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title><%= documentTitle %></title> | |
<!--link rel="stylesheet" href="https://stackedit.io/res-min/themes/base.css" /--> | |
<style type="text/css" media="screen"> | |
/** | |
* 基于 typo.css 和 Entry.css, 感谢他们 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/****** I've created a Chrome extension from this script, take a look at https://github.com/LoranKloeze/WhatsAllApp ********/ | |
/* | |
PoC WhatsApp enumeration of phonenumbers, profile pics, about texts and online statuses | |
Floated div edition | |
01-05-2017 | |
(c) 2017 - Loran Kloeze - loran@ralon.nl | |
This script creates a UI on top of the WhatsApp Web interface. It enumerates certain kinds | |
of information from a range of phonenumbers. It doesn't matter if these numbers are part |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <sys/mman.h> | |
#include <string.h> | |
#include <stdio.h> | |
int main(int argc, char** argv) { | |
size_t size = atoi(argv[1]) * 1024LL * 1024LL * 1024LL; | |
printf("%lu\n", size); | |
void *ptr = malloc(size); | |
memset(ptr, 0xff, size); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <sys/mman.h> | |
#include <string.h> | |
#include <stdio.h> | |
int main(int argc, char** argv) { | |
size_t size = atoi(argv[1]) * 1024LL * 1024LL * 1024LL; | |
printf("%lu\n", size); | |
void *ptr = malloc(size); | |
memset(ptr, 0xff, size); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static mgmt_ipc_err_e | |
mgmt_ipc_conn_remove(queue_task_t *qtask) | |
{ | |
int sid = -1, cid = -1; | |
iscsi_session_t *session; | |
iscsi_conn_t *conn; | |
int err = MGMT_IPC_OK; | |
sid = qtask->req.u.conn.sid; | |
cid = qtask->req.u.conn.cid; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os, errno | |
def isExist(pid): | |
try: | |
os.kill(pid, 0) | |
return True | |
except OSError, e: | |
if e.errno == errno.ESRCH: | |
return False | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
long long f[32]; | |
long long g[32]; | |
class Solution { | |
public: | |
int divide(int dd, int dr) { | |
long long divisor = dr, dividend = dd; | |
int flag = 1; | |
if (divisor < 0) { | |
divisor = -divisor; | |
flag *= -1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define MAXN 10000 | |
int f[MAXN]; | |
int flag[MAXN]; | |
int num[MAXN]; | |
class Solution { | |
public: | |
vector<int> findSubstring(string S, vector<string> &L) { | |
memset(f, -1, sizeof(f)); | |
int m = S.length(); |
NewerOlder