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
char *dup = strdup(str.c_str()); | |
for (char *token = strtok(dup, " ,;"); token != NULL; token = strtok(NULL, " ,;")) { | |
// do something with token | |
} | |
free(dup); |
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 bash | |
printf "\nattempt to renew certificates at " >>/var/log/certbot_cron.log 2>&1 | |
date >>/var/log/certbot_cron.log 2>&1 | |
certbot renew --pre-hook "systemctl stop nginx" --post-hook "systemctl start nginx" --standalone-supported-challenges http-01 >>/var/log/certbot_cron.log 2>&1 | |
printf "renew finished\n" >>/var/log/certbot_cron.log 2>&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
Regions for aws | |
* eu-west-2 | |
* ap-south-1 | |
* us-east-2 | |
* ap-northeast-2 | |
* us-west-2 | |
* ap-southeast-2 | |
* eu-central-1 | |
* eu-west-1 | |
* ca-central-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
syntax = "proto3"; | |
package protocol; | |
import "google/protobuf/empty.proto"; | |
service SSMgrSlave { | |
rpc Allocate(AllocateRequest) returns (google.protobuf.Empty) {} | |
rpc Free(FreeRequest) returns (google.protobuf.Empty) {} | |
rpc GetStats(google.protobuf.Empty) returns (Statistics) {} |
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 main | |
import ( | |
"compress/gzip" | |
"context" | |
"fmt" | |
"io" | |
"os" | |
"os/signal" | |
"path/filepath" |
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
// Basic function | |
package main | |
import "fmt" | |
func add(x, y int) int { | |
return x + y | |
} |
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 demo.powermock; | |
import org.junit.Test; | |
import org.junit.runner.RunWith; | |
import org.powermock.api.mockito.PowerMockito; | |
import org.powermock.core.classloader.annotations.PrepareForTest; | |
import org.powermock.modules.junit4.PowerMockRunner; | |
import static org.junit.Assert.*; |
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 <iostream> | |
#include <opencv2/opencv.hpp> | |
#include <gif_lib.h> | |
int main(int ac, char **av) | |
{ | |
int err; | |
GifFileType *f = DGifOpenFileName("test.gif", &err); | |
assert(f != NULL); | |
int ret = DGifSlurp(f); |
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 python3 | |
# -*- coding: utf-8 -*- | |
__author__ = 'Eric Fu' | |
cipher_file = open('cipher.txt', 'r') | |
dict_file = open('dictionary.tsv', 'r') | |
matrix = [] | |
for line in dict_file.readlines(): |
NewerOlder