Skip to content

Instantly share code, notes, and snippets.

@nielsutrecht
nielsutrecht / Car.java
Created April 26, 2017 12:25
Simple mockito example
public class Car {
private Engine engine;
private FuelTank fuelTank;
public Car(Engine engine, FuelTank fuelTank) {
this.engine = engine;
this.fuelTank = fuelTank;
}
public void start() {
@hannic
hannic / .wp_wp-cli.sh
Last active December 29, 2017 17:39
wp-cli
# WP-CLI - Commands
wp help <befehl>
# update wordpress installation and its database
wp core update
wp core update-db
# update plugins and themes
wp plugin update --all
wp theme update --all
@timvisee
timvisee / falsehoods-programming-time-list.md
Last active May 18, 2025 11:55
Falsehoods programmers believe about time, in a single list

Falsehoods programmers believe about time

This is a compiled list of falsehoods programmers tend to believe about working with time.

Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.

Falsehoods

  • There are always 24 hours in a day.
  • February is always 28 days long.
  • Any 24-hour period will always begin and end in the same day (or week, or month).
@iannase
iannase / soundscraper.py
Created April 8, 2018 22:13
Python web scraper that gets the new / top 50 charts, also allows you to play tracks using the selenium browser
from selenium import webdriver
import requests
import bs4
import os
# new, top, or mix url
top_url = "https://soundcloud.com/charts/top"
new_url = "https://soundcloud.com/charts/new"
track_url = "https://soundcloud.com/search/sounds?q="
artist_url = "https://soundcloud.com/search/people?q="
@carry0987
carry0987 / RPi3-Auto-WiFi.md
Last active April 2, 2025 07:26
Raspberry Pi 3B+ Auto reconnect to wifi when lost connect

Auto reconnect to wifi when lost connection

Before you start, make sure ip command is available on your system. In modern Linux distributions, ip replaces older ifconfig command. If net-tools package (that includes ifconfig) is not installed and you prefer using it, you can install it via sudo apt-get install net-tools.

Create script file

Use touch /home/pi/wifi-reconnect.sh to create a shell script file, with the following content:

#!/bin/bash
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@okajasto
okajasto / augment.py
Created April 1, 2019 20:31
Simple script to augment DonkeyCar tubs
"""
Script to augment teaching data
Usage:
augment.py --path=<source-dir> [--out=<target_dir>] --aug=<name> [--prob=<PROBABILITY>] [--add-prefix] [--start-id=<id>]
Options:
-h --help Show this screen.
--path TUBPATH Path of the record directory
--out TARGETPATH Path to directory where augmented data is placed, directory is created if it doesn't exist
@pansapiens
pansapiens / custom_environments_in_jupyter.ipynb
Last active July 21, 2020 01:53
Using custom environments in Jupyter
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@anantbahuguna
anantbahuguna / README-Template.md
Created April 30, 2020 06:08 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@obax
obax / checkwifi.sh
Last active March 10, 2024 15:02
Rebooting the Raspberry Pi when it loses wireless connection
# Source: https://weworkweplay.com/play/rebooting-the-raspberry-pi-when-it-loses-wireless-connection-wifi/
# Save under /usr/local/bin/checkwifi.sh
# The Raspberry Pi tends to drop network connection (especially wireless wifi) rather fast, which is a real pain when you're trying to do anything that has the RPi running constantly from a remote location (like our RaspEye does).
# However, it's possible to detect wifi connection loss and perform upon it. It's easiest to just do a full system reboot.
# Change the IP on the first line to the IP of your router, or some other device on your network that you can assume will be always online.
# First step is to ping your IP.
# On line three, the $? represents the exit code of the previous command, in this case the ping.