Skip to content

Instantly share code, notes, and snippets.

View 0x8f701's full-sized avatar
🎯
The internet is sick

CJ 0x8f701

🎯
The internet is sick
View GitHub Profile
@0x8f701
0x8f701 / self-signed-certificate-with-custom-ca.md
Created December 3, 2019 12:59 — forked from fntlnz/self-signed-certificate-with-custom-ca.md
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
<template>
<div id="app">
<div class="row flex-center flex-middle">
<label for="msg">Message</label>
<input class="margin" type="text" id="msg" v-model="message">
</div>
<div class="row flex-center">
<button class="paper-btn margin" @click="send">Send</button>
</div>
</div>
@0x8f701
0x8f701 / gist:393abf3731a851abfb8db35ffb7d67f2
Created May 19, 2019 11:10 — forked from julianlam/expose-directory-on-host-to-lxc-container.md
Exposing a directory on the host machine to an LXC container

Exposing a directory on the host machine to an LXC container

  1. Log into the container and create an empty directory, this will be the mount point
  2. Log out and stop the container.
  3. Open to your container's config file
    • For regular LXC containers: /var/lib/lxc/mycontainer/config
    • For unprivileged LXC containers: $HOME/.local/share/lxc/mycontainer/config
  4. Add a new line above the lxc.mount directive, that follows the format below. Substitute proper paths as necessary:
    • lxc.mount.entry = /path/to/folder/on/host /path/to/mount/point none bind 0 0
  • Both of these paths are relative to the host machine.
@0x8f701
0x8f701 / README.md
Created May 14, 2019 12:56 — forked from zhiguangwang/README.md
Rename top-level folder while creating a tar.gz file.
tar czfv NEW_NAME.tar.gz OLD_NAME --transform s/OLD_NAME/NEW_NAME/

Note: this only works with GNU Tar.

Example

we want to tar /opt/zlib/1.2.11 into zlib-1.2.11.tar.gz, and we want the top-level folder inside that tar.gz file to be zlib-1.2.11, not 1.2.11:

@0x8f701
0x8f701 / playground.rs
Created May 11, 2019 10:52 — forked from rust-play/playground.rs
Code shared from the Rust Playground
extern crate tokio;
use std::time::{Duration, Instant};
use tokio::prelude::*;
use tokio::timer;
fn main() {
tokio::run(foo(12));
}
@0x8f701
0x8f701 / letsencrypt_notes.sh
Created May 9, 2019 12:40 — forked from lachesis/letsencrypt_notes.sh
Set up LetsEncrypt using acme.sh without root
# How to use "acme.sh" to set up Lets Encrypt without root permissions
# See https://github.com/Neilpang/acme.sh for more
# This assumes that your website has a webroot at "/var/www/<domain>"
# I'll use the domain "EXAMPLE.com" as an example
# When this is done, there will be an "acme" user that handles issuing,
# updating, and installing certificates. This account will have the following
# (fairly minimal) permissions:
# - Host files at http://EXAMPLE.com/.well-known/acme-challenge
@0x8f701
0x8f701 / indicatif-hyper.rs
Created May 8, 2019 01:54 — forked from clux/indicatif-hyper.rs
indicatif progress bars with hyper 0.10
pub fn http_download_to_path(url: &str, save: &PathBuf) -> Result<()> {
let client = Client::with_connector(HttpsConnector::new(NativeTlsClient::new().unwrap()));
let mut res = client.get(url).send()?;
if res.status != hyper::Ok {
return Err(Error::SomeError)));
}
let use_progress = true;
if use_progress {
use indicatif::{ProgressBar, ProgressStyle};
@0x8f701
0x8f701 / playground.rs
Created May 7, 2019 02:36 — forked from rust-play/playground.rs
Code shared from the Rust Playground
// curl http://localhost:3000 will show the results streaming in.
#![allow(warnings)]
extern crate hyper;
extern crate futures;
extern crate tokio_core;
use tokio_core::net::TcpListener;
use tokio_core::reactor::Core;
use futures::{future, Future};
@0x8f701
0x8f701 / playground.rs
Created May 5, 2019 11:41 — forked from rust-play/playground.rs
Code shared from the Rust Playground
// curl http://localhost:3000 will show the results streaming in.
#![allow(warnings)]
extern crate hyper;
extern crate futures;
extern crate tokio_core;
use tokio_core::net::TcpListener;
use tokio_core::reactor::Core;
use futures::{future, Future};
@0x8f701
0x8f701 / osm_tiles_downloader
Created May 4, 2019 11:36 — forked from tonyrewin/osm_tiles_downloader
small script to download OSM tiles
#!/usr/bin/python
from sys import argv
import os
import math
import urllib2
import random
import os.path
def deg2num(lat_deg, lon_deg, zoom):