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 | |
echo hello world |
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
#[derive(Clone)] | |
pub struct StringJsonifyService<S> { | |
inner: S, | |
} | |
/// Service implementation | |
impl<S, B, ResBody> Service<Request<B>> for StringJsonifyService<S> | |
where | |
S: Service<Request<B>, Response = Response<ResBody>> + Clone + Send + 'static, | |
S::Future: Send + 'static, |
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
const MAX_PERIOD = 256; | |
const RANDOM_SEED = 12345678; | |
const OCTAVE = 4; | |
const LACUNARITY = 2.0; | |
const ATTENUATION = 0.6; | |
/** | |
* @generator | |
* @param {number} seed a 32bit integer |
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 check(): | |
print(a) # referencing undefined variable? | |
if True: | |
a = 1 | |
# when True : 1 | |
# when False: name 'a' is not defined | |
check() |
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 re | |
import sys | |
""" | |
parse size representing string and returns digits and unit in tuple | |
## Example | |
Input: "128mb" | |
Output: (128, "mb") | |
""" | |
def parse_size_string(line: str): |
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
/// | |
/// Hex Program | |
/// | |
/// Prints binary data of a specified file to stdout. | |
/// | |
fn main() { | |
let args: Vec<_> = std::env::args().collect(); | |
if args.len() < 2 { |
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 <stdio.h> | |
#include <locale.h> | |
#include <ctype.h> | |
int main(void) { | |
if (setlocale(LC_ALL, "De_DE") == NULL) { | |
puts("cannot set locale"); | |
} | |
printf("is A umlaut upper?: %d", isupper(196)); | |
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
# from Crypto.Util.number import * | |
from Cryptodome.Util.number import * | |
mb = b'a secret message to be encrypted' | |
m = bytes_to_long(mb) | |
p = getPrime(256) | |
q = getPrime(256) | |
n = p * q |
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
from typing import Tuple | |
""" | |
Euclidean Algorithm | |
Finds GCD(Greatest Common Divisor) from two integers. | |
The algorithm is built on the proof that states common divisors of (A,B) | |
is equal to (B,R) where R is the remainder of A = BQ + R. When R is 0, | |
A = BQ, B is the greatest common divisor of (A,B) because A and B is both |
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 React, { useCallback } from 'react' | |
import { createStore, Action, combineReducers, Dispatch } from 'redux' | |
import { Provider, useDispatch, useSelector } from 'react-redux' | |
// Action Type List. | |
// This ID is used to identify different actions. | |
export const ActionTypes = { | |
Increment: "INCREMENT", | |
Decrement: "DECREMENT", | |
} as const; |
NewerOlder