diamonds <- ggplot2::diamonds
pryr::object_size(diamonds)
#> 3.46 MB
diamonds2 <- transform(diamonds, price_per_carat = price / carat)
pryr::object_size(diamonds2)
#> 3.89 MB
# Size of both data frames combined| // Create a vector of evenly spaced numbers. | |
| vector<double> range(double min, double max, size_t N) { | |
| vector<double> range; | |
| double delta = (max-min)/double(N-1); | |
| for(int i=0; i<N; i++) { | |
| range.push_back(min + i*delta); | |
| } | |
| return range; | |
| } |
How to have some fun using the terminal.
- Install cowsay [0] via :
sudo apt-get install cowsay - Install fortune [1] via :
sudo apt-get install fortune - Install figlet [3] via :
sudo apt-get install figlet - Make sure you have Ruby installed via :
ruby -v - Install the lolcat [2] via : gem
gem install lolcat - (option) Add to .bash_profile and/or .bashrc
More details - http://blog.gbaman.info/?p=791
For this method, alongside your Pi Zero, MicroUSB cable and MicroSD card, only an additional computer is required, which can be running Windows (with Bonjour, iTunes or Quicktime installed), Mac OS or Linux (with Avahi Daemon installed, for example Ubuntu has it built in).
1. Flash Raspbian Jessie full or Raspbian Jessie Lite onto the SD card.
2. Once Raspbian is flashed, open up the boot partition (in Windows Explorer, Finder etc) and add to the bottom of the config.txt file dtoverlay=dwc2 on a new line, then save the file.
3. If using a recent release of Jessie (Dec 2016 onwards), then create a new file simply called ssh in the SD card as well. By default SSH i
| """ Trains an agent with (stochastic) Policy Gradients on Pong. Uses OpenAI Gym. """ | |
| import numpy as np | |
| import cPickle as pickle | |
| import gym | |
| # hyperparameters | |
| H = 200 # number of hidden layer neurons | |
| batch_size = 10 # every how many episodes to do a param update? | |
| learning_rate = 1e-4 | |
| gamma = 0.99 # discount factor for reward |
Essentially just copy the existing video and audio stream as is into a new container, no funny business!
The easiest way to "convert" MKV to MP4, is to copy the existing video and audio streams and place them into a new container. This avoids any encoding task and hence no quality will be lost, it is also a fairly quick process and requires very little CPU power. The main factor is disk read/write speed.
With ffmpeg this can be achieved with -c copy. Older examples may use -vcodec copy -acodec copy which does the same thing.
These examples assume ffmpeg is in your PATH. If not just substitute with the full path to your ffmpeg binary.
| """ | |
| A bare bones examples of optimizing a black-box function (f) using | |
| Natural Evolution Strategies (NES), where the parameter distribution is a | |
| gaussian of fixed standard deviation. | |
| """ | |
| import numpy as np | |
| np.random.seed(0) | |
| # the function we want to optimize |
Next.js, Nginx with Reverse proxy, SSL certificate
- UPDATE (07/20/2021):
- This process got simplified over the years of this gist being out
- Older version of this gist (without certbot): https://gist.github.com/kocisov/2a9567eb51b83dfef48efce02ef3ab06/33fdd88872a0801bdde58fccce430fa48737ae10
- I would also now recommend deploying to Vercel if you don't need custom server support
| #!/bin/bash | |
| # | |
| # Script to create MySQL db + user | |
| # | |
| # @author Raj KB <magepsycho@gmail.com> | |
| # @website http://www.magepsycho.com | |
| # @version 0.1.0 | |
| ################################################################################ |
| # Author: HJ van Veen <info@mlwave.com> | |
| # Description: Experiment to learn a tSNE transformer for new | |
| # test data with a multi-output GBM | |
| # | |
| # Idea first seen at lvdmaaten.github.io/tsne | |
| # > [...] it is not possible to embed test points in an existing | |
| # > map [...] | |
| # > A potential approach to deal with this would be to train | |
| # > a multivariate regressor to predict the map location from | |
| # > the input data. |