Skip to content

Instantly share code, notes, and snippets.

@bbock
bbock / README.md
Last active March 19, 2024 21:14
A PostgresSQL function to merge TeslaMate drives in the database

A PostgresSQL function to merge TeslaMate drives and charges in the database

Please note that the functions are only capable to merge a continuous range of drives/charges.

Make sure that all drives that shall be merged are terminated (how to terminate drives manually is described in the documentation.

Create the function by executing the file with e.g.

docker-compose exec database psql teslamate teslamate < teslamate_merge_drives.sql
@bennadel
bennadel / index.htm
Created August 1, 2018 12:30
Checking To See If An Element Has A CSS Pseudo-Class In JavaScript
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>
Checking To See If An Element Has A CSS Pseudo-Class In JavaScript
</title>
<link rel="stylesheet" type="text/css" href="./demo.css" />
</head>
@PieterScheffers
PieterScheffers / install_forticlient_linux.sh
Created January 22, 2018 16:28
Install Forticlient on Linux
# install ubuntu in virtual machine
# https://ubuntuforums.org/showthread.php?t=1481300
# Get arch type of ubuntu
# i686 = 32 bit
# x86_64 = 64 bit
uname -m
# download forticlient
https://hadler.me/linux/forticlient-sslvpn-deb-packages
@filipelenfers
filipelenfers / installJdkTarGzUbuntu.sh
Last active April 22, 2024 02:02
Install JDK from tar.gz Ubuntu
#Login as root
sudo su
#create jdk directory
mkdir /opt/jdk
#uncompress, change to your file name
tar -zxf jdk-8u5-linux-x64.tar.gz -C /opt/jdk
#check if files are there
@zealfire
zealfire / install_forticlientsslvpn_linux
Created July 2, 2017 14:31
Install forticlient in linux. Replace HOST, PORT, USER and PASS.
sudo apt-get install expect
wget http://kb.cloud.it/files/tar-gz/forticlientsslvpn_linux_4-0-2281-tar.gz
tar xzf forticlientsslvpn_linux_4-0-2281-tar.gz
sudo mv forticlientsslvpn /opt/
cat > sslvpn << EOF
#!/usr/bin/expect -f
set timeout -1
cd /opt/forticlientsslvpn
spawn ./forticlientsslvpn_cli --server HOST:PORT --vpnuser USER
expect "Password for VPN:" {send -- "PASS\r"}
@pcan
pcan / README.md
Created April 3, 2017 09:16
Compile Redis with Cygwin

Prerequisites

Install Cygwin with make, gcc & g++. Download Redis tar.gz package, unpack it.

Patch

Edit deps/hiredis/net.c and add the following lines just after the include directives:

@johnrc
johnrc / jupyterhub-install.sh
Last active May 27, 2020 00:39
JupyterHub setup on centos
#!/bin/sh
curl -O http://repo.continuum.io/archive/Anaconda3-4.0.0-Linux-x86_64.sh
chmod u+x Anaconda3-4.0.0-Linux-x86_64.sh
./Anaconda3-4.0.0-Linux-x86_64.sh -b -p /opt/anaconda3
export PATH=/opt/anaconda3/bin:$PATH
curl --silent --location https://rpm.nodesource.com/setup_4.x | bash -
yum install nodejs -y
npm install -g configurable-http-proxy
pip install jupyterhub
@dhruvbird
dhruvbird / smwc.py
Created February 11, 2015 06:53
Smallest multiple with constraints
"""
Problem statement:
------------------
Given a number 'n', design an algorithm that will output the smallest
integer number 'X' which contains only the digits {0, 1} such that
X mod n = 0 and X > 0
(1 <= n <= 100000)
"""
def solve(n):
if n < 2:
@gavinhungry
gavinhungry / nginx-tls.conf
Last active March 11, 2024 14:51
Nginx SSL/TLS configuration for "A+" Qualys SSL Labs rating
#
# Name: nginx-tls.conf
# Auth: Gavin Lloyd <gavinhungry@gmail.com>
# Desc: Nginx SSL/TLS configuration for "A+" Qualys SSL Labs rating
#
# Enables HTTP/2, PFS, HSTS and OCSP stapling. Configuration options not related
# to SSL/TLS are not included here.
#
# Additional tips:
#
@thomasfr
thomasfr / autossh.service
Last active January 5, 2024 08:11
Systemd service for autossh
[Unit]
Description=Keeps a tunnel to 'remote.example.com' open
After=network.target
[Service]
User=autossh
# -p [PORT]
# -l [user]
# -M 0 --> no monitoring
# -N Just open the connection and do nothing (not interactive)