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
let width = 1500; | |
let height = 1500; | |
let canvas = document.createElement("canvas"); | |
document.body.innerHTML = ""; | |
document.body.appendChild(canvas); | |
canvas.width = width; | |
canvas.height = height; | |
let ctx = canvas.getContext("2d"); | |
let imgdata = ctx.getImageData(0,0,width,height); |
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
/* | |
init commands to run | |
$ npm init | |
$ npm install jsdom | |
$ npm install node-fetch | |
*/ | |
const {JSDOM} = require("jsdom"); | |
const fetch = (()=>{let m = import("node-fetch");return async (...args)=>await (await m).default(...args);})(); | |
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
# input format | |
# 0 n 0 0 0 etc | |
# ^ | |
# simulating input 124 | |
>++++++++++++++++++++++++++++++ | |
++++++++++++++++++++++++++++++ | |
++++++++++++++++++++++++++++++ | |
++++++++++++++++++++++++++++++++++ | |
>>>+<<< | |
# 0 124 0 0 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
#!/bin/bash | |
# first extracting the repository name | |
rep_regex="\\/([^\\/]*)\\.git$" | |
if [[ $1 =~ $rep_regex ]] | |
then | |
reponame="${BASH_REMATCH[1]}" | |
else | |
echo "$1 doesn't match" >&2 # this could get noisy if there are a lot of non-matching files | |
exit |
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 range_include(a,b){ | |
let arr = []; | |
for(; a <= b; a++){ | |
arr.push(a); | |
} | |
return arr; | |
} | |
//array of the object | |
let Arrayobject = range_include(1,10).map((i)=>{ |
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
//array of the object | |
let Arrayobject=[ | |
{ | |
section:'Dynamic Table', | |
marks:10 | |
}, | |
{ | |
section:'Intellij Usage', | |
marks: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
Array(6).fill(0).map(a=>("00"+Math.floor(Math.random()*256).toString(16)).substr(-2).toUpperCase()).join(":") |
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
let txt = | |
`bwbwbwbwbwbwbwbwbrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr | |
bbbwbwbwbwbwbwbwbbsssssssssssssssssssssssssssssssssss | |
bwbwbwbwbwbwbwbwbrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr | |
bbbwbwbwbwbwbwbwbbsssssssssssssssssssssssssssssssssss | |
bwbwbwbwbwbwbwbwbrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr | |
bbbwbwbwbwbwbwbwbbsssssssssssssssssssssssssssssssssss | |
bwbwbwbwbwbwbwbwbrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr | |
ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss | |
rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr |
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
var primes = []; | |
var cond = [1]; | |
for(var i = 2; i < 335; i++){ | |
var flag = true; | |
var primeFlag = true; | |
for(var j = 0; j < primes.length; j++){ | |
var prime = primes[j]; | |
if(prime*prime > i)break; | |
primeFlag = primeFlag && (i%prime !== 0) | |
// flag === true if not divisible by any prime |
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 <stdio.h> | |
// for testing purposes only | |
# include <stdlib.h> | |
# include <unistd.h> | |
# include <sys/time.h> | |
# include <time.h> | |
int lengthUntilNull(char * str){ | |
int i = 0; | |
while(str[i] != 0){ |