This file contains hidden or 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
/* Copyright 20kSize Rafael Rendón Pablo <[email protected]> */ | |
// region Template | |
#include <bits/stdc++.h> | |
using namespace std; | |
typedef long long int64; | |
typedef unsigned long long uint64; | |
const double kEps = 10e-8; | |
const int kMax = 100005; | |
const int kInf = 1 << 30; | |
const int kSize = 16; |
This file contains hidden or 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
/* Copyright 2016 Rafael Rendón Pablo <[email protected]> */ | |
// In this code array means persistent array and will be denoted by "array*". | |
#include <bits/stdc++.h> | |
using namespace std; | |
const int kMax = 10000; | |
// Node describes a node in the tree. | |
struct Node { | |
// Array* index. | |
int idx; |
This file contains hidden or 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> | |
using namespace std; | |
int main(int argc, char *argv[]) { | |
ios::sync_with_stdio(false); | |
cin.tie(nullptr); | |
int T; | |
cin >> T; | |
while (T--) { | |
int n; |
This file contains hidden or 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
QTabBar { | |
background-color: #949191; | |
} | |
QTabBar::tab { | |
height: 20px; | |
border: none; | |
padding: 0; | |
} |
This file contains hidden or 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 DisjointSet: | |
def __init__(self, size): | |
self.id = [i for i in range(size)] | |
self.size = [1 for i in range(size)] | |
def root(self, u): | |
if self.id[u] == u: | |
return u | |
return self.root(self.id[u]) |
This file contains hidden or 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 unittest | |
from disjoint_set import DisjointSet | |
class DisjointSetTest(unittest.TestCase): | |
def test_connectedness(self): | |
ds = DisjointSet(5) | |
self.assertFalse(ds.connected(0, 4)) | |
ds.connect(0, 4) | |
self.assertTrue(ds.connected(0, 4)) |
This file contains hidden or 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
/* Copyright 2016 Rafael Rendón Pablo <[email protected]> */ | |
// region Template | |
#include <bits/stdc++.h> | |
using namespace std; | |
typedef long long int64; | |
typedef unsigned long long uint64; | |
const double kEps = 10e-8; | |
const int kMax = 1000; | |
const int kInf = 1 << 30; | |
const int kRedEdge = 1; |
This file contains hidden or 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
<?xml version="1.0"?> | |
<root> | |
<item> | |
<name>My settings</name> | |
<identifier>private.mysettings</identifier> | |
<autogen>__KeyToKey__ KeyCode::D, ModifierFlag::COMMAND_L, ConsumerKeyCode::MUSIC_NEXT</autogen> | |
<autogen>__KeyToKey__ KeyCode::S, ModifierFlag::COMMAND_L, ConsumerKeyCode::MUSIC_PREV</autogen> | |
<autogen>__KeyToKey__ KeyCode::P, ModifierFlag::COMMAND_L, ConsumerKeyCode::MUSIC_PLAY</autogen> | |
<autogen>__KeyToKey__ KeyCode::EQUAL, ModifierFlag::COMMAND_L, ConsumerKeyCode::VOLUME_UP</autogen> | |
<autogen>__KeyToKey__ KeyCode::MINUS, ModifierFlag::COMMAND_L, ConsumerKeyCode::VOLUME_DOWN</autogen> |
This file contains hidden or 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
$.post( | |
"http://myapi.com/v1/assets", | |
JSON.stringify({ | |
name: name, | |
email: email | |
}), | |
function(data) { | |
alert(data.message); | |
}, | |
"json" |
This file contains hidden or 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 'rugged' | |
dir = "/home/rendon/repos/snippet001/" | |
name = "README.md" | |
# For existing repositories | |
#repo = Rugged::Repository.new(dir) | |
repo = Rugged::Repository.init_at(dir) | |
File.open(File.join(dir, name), "w") do |f| |