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
import java.util.Arrays; | |
import java.util.Collection; | |
import java.util.List; | |
public class Main { | |
public static void main(String[] args) { | |
List<List<Integer>> nested = Arrays.asList( | |
Arrays.asList(1, 2, 3), | |
Arrays.asList(4, 5, 6), | |
Arrays.asList(7, 8, 9) |
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
import java.util.Map; | |
import java.util.TreeMap; | |
import java.util.SortedMap; | |
import java.security.MessageDigest; | |
import java.security.NoSuchAlgorithmException; | |
import java.math.BigInteger; | |
import java.io.UnsupportedEncodingException; | |
public class ConsistentHash { | |
private static int MAX_REPLICA = 100; |
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
def caesar_enc(plain, key): | |
plain = plain.encode('utf-8') | |
cipher = bytearray(plain) | |
for i, c in enumerate(plain): | |
cipher[i] = (c + key) & 0xff | |
return bytes(cipher) | |
def caesar_dec(cipher, key): | |
plain = bytearray(len(cipher)) # at most, len(plain) <= len(cipher) | |
for i, c in enumerate(cipher): |
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 <stdlib.h> | |
#include <time.h> | |
#include <stdio.h> | |
#include <assert.h> | |
#include <stdbool.h> | |
typedef struct { | |
size_t rows; | |
size_t columns; |
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
def compute_ean13_checksum(barcode): | |
assert len(barcode) == 12 and barcode.isdigit() | |
return (10 - sum(int(i) * j for i, j in zip(barcode, (1, 3) * 6)) % 10) % 10 |
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
import java.io.ByteArrayInputStream | |
import java.io.InputStream | |
import java.io.PrintStream | |
import java.util.* | |
import java.util.concurrent.Callable | |
enum class Token constructor(val symbol: String) { | |
IF("if"), | |
ELSE("else"), |
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 <Windows.h> | |
#include <cassert> | |
int | |
main(int argc, char** argv) | |
{ | |
(void)argc; | |
(void)argv; |
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 <Windows.h> | |
#include <cassert> | |
int | |
main(int argc, char **argv) | |
{ | |
(void)argc; | |
(void)argv; | |
// التعليمات مولّدة من هذا الكود: |
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
// مثال لخطف دالة عن طريق استبدال عنوانها في جدول عناوين الدوال المستوردة | |
// https://twitter.com/barakatsoror/status/1020710139475759105 | |
#include <Windows.h> | |
#include <winternl.h> | |
#include <cstdio> | |
#include <cassert> | |
#include <winnt.h> | |
#include <cstring> | |
#include <cwchar> |
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 <Windows.h> | |
typedef bool (__stdcall *NDA_SetIlluminationParm_t)(int adapter_index, int attribute, int value); | |
typedef bool (__stdcall *NDA_GetIlluminationParm_t)(int adapter_index, int attribute, int *value); | |
typedef bool (__stdcall *NDA_GetGPUCounts_t)(int *gpu_count); | |
typedef bool (__stdcall *NDA_Initialize_t)(); | |
typedef bool (__stdcall *NDA_Unload_t)(); | |
int | |
main() |
OlderNewer