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
// Go to chrome://settings/searchEngines | |
// Open the Developer Tools | |
// Run the following in the Javascript console tab | |
const otherEngines = document.querySelector("body > settings-ui") | |
.shadowRoot.querySelector("#main") | |
.shadowRoot.querySelector("settings-basic-page") | |
.shadowRoot.querySelector("#basicPage > settings-section.expanded > settings-search-page") | |
.shadowRoot.querySelector("#pages > settings-subpage > settings-search-engines-page") | |
.shadowRoot.querySelector("#otherEngines").shadowRoot |
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 argparse | |
class RSA: | |
def __init__(self, p, q, e): | |
self.p, self.q, self.e = p, q, e | |
self.n = p * q | |
self.phi = (p - 1) * (q - 1) | |
self.d = e ** (self.phi - 1) % self.phi |
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 javax.crypto.*; | |
import javax.crypto.spec.DESKeySpec; | |
import java.util.Arrays; | |
public class TripleDES { | |
enum MODE { | |
ENCRYPT(0), DECRYPT(1); | |
int code; |
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 javax.crypto.*; | |
import javax.crypto.spec.DESKeySpec; | |
import java.util.Arrays; | |
import java.util.stream.LongStream; | |
public class BruteDES { | |
public static byte[] encrypt(byte[] plaintext, byte[] rawkey) { | |
try { | |
return _digest(plaintext, rawkey, Cipher.ENCRYPT_MODE); |
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 <fstream> | |
#include <algorithm> | |
#include "XText.h" | |
class Caesar | |
{ | |
public: | |
static Chipertext encrypt(Plaintext plaintext, int key) | |
{ | |
std::string chipertext; |
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
!#/bin/bash | |
sudo fallocate -l 1G /swapfile | |
sudo chmod 600 /swapfile | |
sudo mkswap /swapfile | |
sudo swapon /swapfile | |
sudo cp /etc/fstab /etc/fstab.bak | |
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab |
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
#!/bin/bash | |
hadoop fs -rm -R shakespeare | |
hadoop fs -mkdir -p shakespeare/input | |
hadoop fs -put input/* shakespeare/input | |
hadoop jar /usr/lib/hadoop-mapreduce/hadoop-streaming-2.6.0-cdh5.13.0.jar -input shakespeare/input -output shakespeare/output -mapper "python `pwd`/mapper.py" -reducer "python `pwd`/reducer.py" | |
hadoop fs -cat shakespeare/output/part* | head -n 10 |
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 <iostream> | |
#include <vector> | |
using namespace std; | |
template <typename T> | |
void _Merge(vector<T> &a, int low, int mid, int high) | |
{ | |
int n, p, q, | |
l = mid - low + 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
function score = sudoku(x) | |
x = reshape(round(x), 4, 4); | |
x(1,1) = 1; | |
x(1,4) = 2; | |
x(2,3) = 1; | |
x(3,2) = 3; | |
x(4,1) = 4; | |
x(4,4) = 3; | |
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 <iostream> | |
#include <list> | |
#include <algorithm> | |
using namespace std; | |
template<typename T = int> | |
class Replacement | |
{ | |
public: |
NewerOlder