Skip to content

Instantly share code, notes, and snippets.

@canwe
canwe / wget.sh
Created November 1, 2020 20:10 — forked from crittermike/wget.sh
Download an entire website with wget, along with assets.
# One liner
wget --recursive --page-requisites --adjust-extension --span-hosts --convert-links --restrict-file-names=windows --domains yoursite.com --no-parent yoursite.com
# Explained
wget \
--recursive \ # Download the whole site.
--page-requisites \ # Get all assets/elements (CSS/JS/images).
--adjust-extension \ # Save files with .html on the end.
--span-hosts \ # Include necessary assets from offsite as well.
--convert-links \ # Update links to still work in the static version.
@canwe
canwe / README.md
Created October 31, 2020 08:36 — forked from joyrexus/README.md
groupby and countby for python

groupby and countby for python

Python has the standard methods for applying functions over iterables, viz. map, filter, and reduce.

For example, we can use filter to filter some numbers by some criterion:

even = lambda x: x % 2 is 0
odd  = lambda x: not even(x)
data = [1, 2, 3, 4]
#!/bin/sh
# How to prepare your linux box to run ARM64 images in docker
# https://codepyre.com/2019/12/arming-yourself/
wget https://download.qemu.org/qemu-4.2.0.tar.xz
tar xf qemu-4.2.0.tar.xz
cd qemu-4.2.0
apt install -y bison flex build-essential libglib2.0-dev libpixman-1-dev qemu binfmt-support
./configure --target-list=aarch64-linux-user,arm-linux-user --static
@canwe
canwe / gist:96050341f19321d0dab5536ab61699f6
Created August 8, 2020 12:31 — forked from wacko/gist:5577187
SSH between Mac OS X host and Virtual Box guest

On Mac OS (host):

Shutdown your VM and do:

VirtualBox > Settings > Network > Add (you will get vboxnet0)

On a terminal ifconfig will show you new interface vboxnet0

VM's Settings > System > check "Enable I/O APIC." VM's Settings > Network > Adapter 2 > host-only vboxnet0

(archived from: https://plus.google.com/+RipRowan/posts/eVeouesvaVX)
Stevey's Google Platforms Rant
I was at Amazon for about six and a half years, and now I've been at Google for
that long. One thing that struck me immediately about the two companies -- an
impression that has been reinforced almost daily -- is that Amazon does
everything wrong, and Google does everything right. Sure, it's a sweeping
generalization, but a surprisingly accurate one. It's pretty crazy. There are
probably a hundred or even two hundred different ways you can compare the two
@canwe
canwe / tokens.md
Created May 1, 2020 09:56 — forked from zmts/tokens.md
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Last major update: 20.04.2020

  • Что такое авторизация/аутентификация
  • Где хранить токены
  • Как ставить куки ?
  • Процесс логина
  • Процесс рефреш токенов
  • Кража токенов/Механизм контроля токенов
@canwe
canwe / ssl-cert-info.sh
Created October 4, 2019 10:53
Shell script to check SSL certificate info like expiration date and subject. Taken from http://giantdorks.org/alain/shell-script-to-check-ssl-certificate-info-like-expiration-date-and-subject/
#!/bin/bash
usage()
{
cat <<EOF
Usage: $(basename $0) [options]
This shell script is a simple wrapper around the openssl binary. It uses
s_client to get certificate information from remote hosts, or x509 for local
certificate files. It can parse out some of the openssl output or just dump all
@canwe
canwe / openssl_commands.md
Created October 2, 2019 12:31 — forked from p3t3r67x0/openssl_commands.md
Some list of openssl commands for check and verify your keys

openssl

Install

Install the OpenSSL on Debian based systems

sudo apt-get install openssl
@canwe
canwe / android-websters.md
Created September 30, 2019 11:54 — forked from jsomers/android-websters.md
Instructions for using Webster's 1913 on Android

To use Webster's 1913 dictionary on Android, install Colordict 3, an app that accepts this StarDict format. https://play.google.com/store/apps/details?id=com.socialnmobile.colordict

Next download James's S3 archive. https://s3.amazonaws.com/jsomers/dictionary.zip

You will need to extract the .dict file from inside three containers - .dz, .tar, .bz2 from innermost to outermost. 7zip handles all of these formats.

Place the .dict, .idx and .ifo files in the dictdata directory on your sdcard or local storage root. This is where colordict looks for dictionaries.

When the files are in the right place, you can run Colordict and tap the folder icon in the top right to see the dictionaries installed and set the dictionary priority. I put the 1913 dictionary above the defaults "Wordnet" and "Wikipedia." When you look up a word, ColorDict shows the definition, if available, from these multiple sources.

#!/usr/bin/python3.5
# -*-coding:Utf-8 -*
import random
import operator
import time
import matplotlib.pyplot as plt
temps1 = time.time()