Skip to content

Instantly share code, notes, and snippets.

@sudo-panda
sudo-panda / erase_if_construct.cpp
Last active August 11, 2020 16:23
C++ tips to get around TLE : erase_if() template
v.erase(std::remove_if(v.begin(), v.end(), predicate), v.end());
@sudo-panda
sudo-panda / string_add_assign.cpp
Created August 11, 2020 16:15
C++ tips to get around TLE : string addition assignment
s += "appended string";
@sudo-panda
sudo-panda / string_append.cpp
Created August 11, 2020 16:12
C++ tips to get around TLE : string append
s.append("appended string");
@sudo-panda
sudo-panda / vector_reserve.cpp
Created August 11, 2020 15:42
C++ tips to get around TLE : vector with reserve
std::vector<int> v;
v.reserve(max);
@sudo-panda
sudo-panda / fastscan.cpp
Created August 11, 2020 15:35
C++ tips to get around TLE : fastscan
void fastscan(int &x)
{
bool neg=false;
register int c;
x =0;
c=getchar();
if(c=='-')
{
neg = true;
c=getchar();
@sudo-panda
sudo-panda / desync_stdio.cpp
Created August 11, 2020 15:22
C++ tips to get around TLE : desync with stdio
std::ios_base::sync_with_stdio(false);
std::cin.tie(NULL);
@sudo-panda
sudo-panda / debug.log
Created July 21, 2020 05:33
stacktrace and debug for gradlew build
10:57:50.161 [INFO] [org.gradle.BuildLogger] Starting Build
10:57:50.166 [DEBUG] [org.gradle.BuildLogger] Gradle user home: /home/sudo-panda/.gradle
10:57:50.168 [DEBUG] [org.gradle.BuildLogger] Current dir: /home/sudo-panda/Documents/PRISM/gradel
10:57:50.168 [DEBUG] [org.gradle.BuildLogger] Settings file: null
10:57:50.168 [DEBUG] [org.gradle.BuildLogger] Build file: null
10:57:50.171 [DEBUG] [org.gradle.initialization.buildsrc.BuildSourceBuilder] Starting to build the build sources.
10:57:50.171 [DEBUG] [org.gradle.initialization.buildsrc.BuildSourceBuilder] Gradle source dir does not exist. We leave.
10:57:50.172 [DEBUG] [org.gradle.initialization.DefaultGradlePropertiesLoader] Found env project properties: []
10:57:50.173 [DEBUG] [org.gradle.initialization.DefaultGradlePropertiesLoader] Found system project properties: []
10:57:50.205 [DEBUG] [org.gradle.initialization.ScriptEvaluatingSettingsProcessor] Timing: Processing settings took: 0.032 secs
@sudo-panda
sudo-panda / error.log
Created May 7, 2020 00:34
Error while builing cpp-jwt
Scanning dependencies of target test_jwt_es
[ 5%] Building CXX object tests/CMakeFiles/test_jwt_es.dir/test_jwt_es.cc.o
[ 10%] Linking CXX executable test_jwt_es
CMakeFiles/test_jwt_es.dir/test_jwt_es.cc.o: In function `ESAlgo_ES256EncodingDecodingTest_Test::TestBody()':
test_jwt_es.cc:(.text+0x1a19): undefined reference to `testing::Message::Message()'
test_jwt_es.cc:(.text+0x1a44): undefined reference to `testing::internal::GetBoolAssertionFailureMessage[abi:cxx11](testing::AssertionResult const&, char const*, char const*, char const*)'
test_jwt_es.cc:(.text+0x1a79): undefined reference to `testing::internal::AssertHelper::AssertHelper(testing::TestPartResult::Type, char const*, int, char const*)'
test_jwt_es.cc:(.text+0x1a92): undefined reference to `testing::internal::AssertHelper::operator=(testing::Message const&) const'
test_jwt_es.cc:(.text+0x1aa1): undefined reference to `testing::internal::AssertHelper::~AssertHelper()'
test_jwt_es.cc:(.text+0x1cf0): undefined reference to `testing::Message::Messag
@sudo-panda
sudo-panda / plotly_html_wrapper.cpp
Created April 5, 2020 17:53
Compile the plotly_html_wrapper.cpp and run it with the prfix file in the same directory as the executable. You have to provide the path to the json file generated using command line. You can optionally give the
#include <fstream>
#include <iostream>
int main(int argc, char** argv)
{
if(argc >= 2)
{
std::ifstream json(argv[1]);
std::ifstream prefix_html("prefix_html");
@sudo-panda
sudo-panda / 3dscatter.json
Created March 23, 2020 16:50
Plot.ly json file for testing its json editor
{
data: [{
"meta": {
"columnNames": {
"x": "A",
"y": "B",
"z": "C"
}
},
"mode": "markers",