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
#!/usr/bin/env bash | |
set -euo pipefail | |
log() { echo -e "\033[1;32m[+]\033[0m $1"; } | |
err() { echo -e "\033[1;31m[!]\033[0m $1" >&2; } | |
[[ "$EUID" -eq 0 ]] || { err "Run as root"; exit 1; } | |
if [[ $# -lt 4 || $# -gt 8 ]]; then | |
err "Usage:" |
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
#!/usr/bin/env bash | |
set -euo pipefail | |
ARCH="linux-x64" | |
BASE_URL="https://nodejs.org/download/release" | |
log() { | |
echo -e "\033[1;32m==>\033[0m $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
use std::env::args; | |
use rayon::prelude::*; | |
fn is_prime(n: u64, primes: &[u64]) -> bool { | |
let sqrt = (n as f64).sqrt() as u64; | |
for &p in primes { | |
if p > sqrt { | |
break; | |
} |
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
server { | |
listen 80; | |
server_name webhook.yourdomain.com; | |
location / { | |
proxy_pass http://localhost:9000; | |
proxy_set_header Host $host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
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
const req = new XMLHttpRequest() | |
req.addEventListener('load', (event) => { | |
console.log(event.target.response) | |
}) | |
req.open('https://jsonplaceholder.typicode.com/posts') | |
req.send() |
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
// Promises without dates | |
(async function main() { | |
const promise1 = new Promise((resolve, reject) => { | |
setTimeout(() => { | |
resolve('Promise 1') | |
}, 5000) | |
}) | |
const promise2 = new Promise((resolve, reject) => { | |
setTimeout(() => { |
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
name: Deploy | |
on: | |
push: | |
branches: | |
- main | |
- master | |
pull_request: | |
branches: | |
- main |
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/sh | |
## Set error handling | |
set -e | |
## Set debug mode | |
#set -x | |
GREEN='\033[0;32m' | |
RED='\033[0;31m' | |
YELLOW='\033[0;33m' |
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
#!/usr/bin/env bash | |
# based on https://github.com/sbimochan/smart-commit/blob/master/commit | |
# am@aleksei feature/CO-400-some-branch-name$ ./smart-commit.sh "Foo bar." | |
# → [feature/CO-400-some-branch-name f70ebbf167] CO-400: Foo bar. | |
set -euo pipefail | |
if [ -z "${1:-}" ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then |
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
<?php | |
namespace App\Http\Middleware; | |
use Closure; | |
use Symfony\Component\HttpFoundation\ParameterBag; | |
/** | |
* @author https://github.com/Stunext | |
* |
NewerOlder