docker run --name recorder-redis -p 6379:6379 -d redis:alpine
This file contains 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
// Windows | |
// g++ *.cpp -o vulkan -lSDL2main -lSDL2 -lvulkan-1 | |
// Linux | |
// g++ *.cpp -o vulkan -lSDL2main -lSDL2 -lvulkan | |
// https://vulkan-tutorial.com/ | |
#include <iostream> | |
using namespace std; | |
#include <SDL2/SDL.h> |
This file contains 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
default['sshd']['sshd_config']['AuthenticationMethods'] = 'publickey,keyboard-interactive:pam' | |
default['sshd']['sshd_config']['ChallengeResponseAuthentication'] = 'yes' | |
default['sshd']['sshd_config']['PasswordAuthentication'] = 'no' |
This file contains 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
<style type="text/css"> | |
@font-face { | |
font-family: 'Open Sans'; | |
font-style: normal; | |
font-weight: 300; | |
src: local('Open Sans Light'), local('OpenSans-Light'), url(http://fonts.gstatic.com/s/opensans/v13/DXI1ORHCpsQm3Vp6mXoaTa-j2U0lmluP9RWlSytm3ho.woff2) format('woff2'); | |
unicode-range: U+0460-052F, U+20B4, U+2DE0-2DFF, U+A640-A69F; | |
} | |
.body { | |
width: 90%; |
This file contains 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
# Redis Cheatsheet | |
# All the commands you need to know | |
redis-server /path/redis.conf # start redis with the related configuration file | |
redis-cli # opens a redis prompt | |
# Strings. |
This file contains 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/bash | |
# Stop all containers | |
containers=`docker ps -a -q` | |
if [ -n "$containers" ] ; then | |
docker stop $containers | |
fi | |
# Delete all containers | |
containers=`docker ps -a -q` | |
if [ -n "$containers" ]; then | |
docker rm -f -v $containers |
This file contains 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
// copy/paste into chrome console (alt+cmd+J) after the video starts playing. | |
setInterval(function() { | |
var possibleButtons = document.getElementsByClassName('continue-playing'); | |
if (possibleButtons.length) { | |
for (var i = 0; i < possibleButtons.length; i++) { | |
if (/Continue Playing/.test(possibleButtons[i].textContent)) { | |
var event = document.createEvent('HTMLEvents'); | |
event.initEvent('click', true, false); | |
possibleButtons[i].dispatchEvent(event); | |
} |
This file contains 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
// Create our own MyResponseWriter to wrap a standard http.ResponseWriter | |
// so we can store the status code. | |
type MyResponseWriter struct { | |
status int | |
http.ResponseWriter | |
} | |
func NewMyResponseWriter(res http.ResponseWriter) *MyResponseWriter { | |
// Default the status code to 200 | |
return &MyResponseWriter{200, res} |
This file contains 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
App configuration in environment variables: for and against | |
For (some of these as per the 12 factor principles) | |
1) they are are easy to change between deploys without changing any code | |
2) unlike config files, there is little chance of them being checked | |
into the code repo accidentally | |
3) unlike custom config files, or other config mechanisms such as Java |
This file contains 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
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; | |
import org.springframework.security.web.session.InvalidSessionStrategy; | |
import org.springframework.util.StringUtils; | |
import javax.servlet.ServletException; | |
import javax.servlet.http.HttpServletRequest; | |
import javax.servlet.http.HttpServletResponse; | |
import java.io.IOException; |
NewerOlder