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 <bits/stdc++.h> | |
// #include <iostream> | |
// #include <vector> | |
// #include <algorithm> | |
// #include <map> | |
#include <cstdio> | |
#include <cstdlib> | |
#include <cassert> | |
using namespace std; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
declare -r TEST="test" # read-only | |
TEST="!" # causes an error | |
echo ${TEST} |
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 <list> | |
#include <cstdio> | |
using namespace std; | |
class LIFO { | |
public: | |
void push_back(int a) { | |
mList.push_back(a); | |
} |
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 <cstdio> | |
#define MARKER(fmt, ...) printf("%s: %d: %s(): " fmt "\n", __FILE__, __LINE__ , __func__, ##__VA_ARGS__) | |
int main(int argc, char *argv[]) | |
{ | |
MARKER("test %d", 100); | |
return 0; | |
} |
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 <cstdio> | |
void checkVTBL0andCall(void* ptr) | |
{ | |
long long* ptr_object = (long long*)ptr; | |
printf("ptr_object = %llx\n", (long long)ptr_object); | |
long long vptr = ptr_object[0]; | |
printf("vptr = %llx\n", (long long)vptr); |
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
class ClassA | |
{ | |
public: | |
void destroy() const | |
{ | |
delete this; | |
} | |
static ClassA* create() | |
{ |
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
int a[] = {1, 2, 3, 4, 5}; | |
vector<int> example(a, a + sizeof(a) / sizeof(a[0])); |
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
require 'net/http' | |
require 'uri' | |
require 'pp' | |
def expandShortenURI(s) | |
uri = URI(s) | |
Net::HTTP.start(uri.host, uri.port) {|http| | |
response = http.head(uri.request_uri) | |
case response | |
when Net::HTTPRedirection |
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
sudo chown root:root adb | |
sudo chmod u+sx adb |
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
person1<-function(x) { x } | |
person2<-function(x) { 2 * (x-10)} | |
plot(0, type="n", xlim=c(0,50), ylim=c(0,100), xlab="t", ylab="Performance") | |
curve(person1, 0, 50, add=T, col="blue") | |
curve(person2, 10, 50, add=T, col="red") | |
legend("topright", legend=c("Person with 1H", "Person with 2H"), pch=c(4,4), col=c("blue", "red")) | |
person1<-function(x) { 1 * exp(0.15 * x) - 1 } | |
person2<-function(x) { 4 * exp(0.15 * (x - 10)) - 4} | |
plot(0, type="n", xlim=c(0,50), ylim=c(0,500), xlab="t", ylab="Performance") |
NewerOlder