Skip to content

Instantly share code, notes, and snippets.

View crotel's full-sized avatar
😉
have a good day~

CROTEL crotel

😉
have a good day~
View GitHub Profile
@crotel
crotel / rsa.js
Created November 28, 2022 14:30 — forked from sohamkamani/rsa.js
An example of RSA Encryption implemented in Node.js
const crypto = require("crypto")
// The `generateKeyPairSync` method accepts two arguments:
// 1. The type ok keys we want, which in this case is "rsa"
// 2. An object with the properties of the key
const { publicKey, privateKey } = crypto.generateKeyPairSync("rsa", {
// The standard secure default length for RSA keys is 2048 bits
modulusLength: 2048,
})
@crotel
crotel / LICENSE
Created September 15, 2022 08:47 — forked from Techcable/LICENSE
All rights reserved License
All Rights Reserved
Copyright (c) ${project.inceptionYear} ${owner}
Created by Techcable
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
@crotel
crotel / status-codes.csv
Last active June 23, 2022 02:30
status-codes.csv
Value Description Reference
1×× Informational
100 Continue [RFC-ietf-httpbis-semantics, Section 15.2.1]
101 Switching Protocols [RFC-ietf-httpbis-semantics, Section 15.2.2]
102 Processing [RFC2518]
103 Early Hints [RFC8297]
104-199 Unassigned
2×× Success
200 OK [RFC-ietf-httpbis-semantics, Section 15.3.1]
201 Created [RFC-ietf-httpbis-semantics, Section 15.3.2]
@crotel
crotel / cloudflareworker-verifyjwt.js
Created June 7, 2022 03:12 — forked from bcnzer/cloudflareworker-verifyjwt.js
Sample Cloudflare worker that gets the JWT, ensures it hasn't expired, decrypts it and returns a result
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
})
// Following code is a modified version of that found at https://blog.cloudflare.com/dronedeploy-and-cloudflare-workers/
/**
* Fetch and log a request
* @param {Request} request
*/
@crotel
crotel / build_leveldb.sh
Created May 23, 2022 03:24 — forked from siddontang/build_leveldb.sh
leveldb build shell
#!/bin/bash
SNAPPY_DIR=/usr/local/snappy
LEVELDB_DIR=/usr/local/leveldb
ROOT_DIR=$(pwd)
BUILD_DIR=/tmp/build_leveldb
mkdir -p $BUILD_DIR
@crotel
crotel / 0_urllib2.py
Created May 6, 2022 04:36 — forked from kennethreitz/0_urllib2.py
urllib2 vs requests
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib2
gh_url = 'https://api.github.com'
req = urllib2.Request(gh_url)
password_manager = urllib2.HTTPPasswordMgrWithDefaultRealm()
@crotel
crotel / web-servers.md
Created May 3, 2022 05:28 — forked from vidluther/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@crotel
crotel / httpd.asm
Created March 30, 2022 04:41 — forked from xenomuta/httpd.asm
httpd.asm: Arguably the world smallest web server. ( for GNU/Linux i386. Compile with nasm )
section .text
global _start
_start:
xor eax, eax
xor ebx, ebx
xor esi, esi
jmp _socket
_socket_call:

REFERENCES FOR LEARNING & USING APPLESCRIPT Modified: 2018/06/19 18:47


NOTES

AppleScript is a rather peculiar scripting language to learn.

@crotel
crotel / pretty-json
Created March 25, 2022 06:22 — forked from scottslowe/pretty-json
This output came from running the raw JSON-serialized response to a REST API through the python json.tool command.
{
"result_count": 3,
"results": [
{
"_href": "/ws.v1/lswitch/3ca2d5ef-6a0f-4392-9ec1-a6645234bc55",
"_schema": "/ws.v1/schema/LogicalSwitchConfig",
"type": "LogicalSwitchConfig"
},
{
"_href": "/ws.v1/lswitch/81f51868-2142-48a8-93ff-ef612249e025",