Skip to content

Instantly share code, notes, and snippets.

@carry0987
carry0987 / RPi3-Auto-WiFi.md
Last active Jun 24, 2022
Raspberry Pi 3B+ Auto reconnect to wifi when lost connect
View RPi3-Auto-WiFi.md

Auto reconnect to wifi when lost connect

Create script file

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

#!/bin/bash 
 
SSID=$(/sbin/iwgetid --raw) 
@ZwodahS
ZwodahS / copy_redis_key.sh
Created Mar 1, 2016
copy a redis db key to another place (use MIGRATE COPY for v3.0<= redis)
View copy_redis_key.sh
#!/bin/bash
# source http://stackoverflow.com/questions/23222616/copy-all-keys-from-one-db-to-another-in-redis
#set connection data accordingly
source_host=localhost
source_port=6379
source_db=1
target_host=localhost
target_port=6379
target_db=2
@drmalex07
drmalex07 / README-setup-tunnel-as-systemd-service.md
Last active Aug 12, 2022
Setup a secure (SSH) tunnel as a systemd service. #systemd #ssh #ssh-tunnel #ssh-forward
View README-setup-tunnel-as-systemd-service.md

README

Create a template service file at /etc/systemd/system/secure-tunnel@.service. The template parameter will correspond to the name of target host:

[Unit]
Description=Setup a secure tunnel to %I
After=network.target
@spalladino
spalladino / mysql-docker.sh
Created Dec 22, 2015
Backup and restore a mysql database from a running Docker mysql container
View mysql-docker.sh
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@nishanths
nishanths / main.js
Last active Aug 7, 2019
Electron tray: Drag and Drop events demo
View main.js
var app = require('app');
var Menu = require('menu');
var Tray = require('tray');
var appIcon = null;
app.on('ready', function(){
// image is null, so image will not be shown in menu bar
// so click around on the system menu bar to locate the space where the tray icon is
appIcon = new Tray(null);
@myusuf3
myusuf3 / delete_git_submodule.md
Created Nov 3, 2014
How effectively delete a git submodule.
View delete_git_submodule.md

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
View timelapse-assembler.sh
mkdir temp
cp *.JPG temp/.
mogrify -resize 200x200 temp/*.JPG
convert temp/*.JPG -delay 10 -morph 5 temp/%05d.jpg
ffmpeg -r 50 -qscale 2 -i temp/%05d.jpg output.mp4
@KonradIT
KonradIT / autoexec.ash
Created Jan 26, 2014
Set custom exp, replace iris, gain, and shutter by your custom settings
View autoexec.ash
sleep 2
t ia2 -exp set 1 iris gain shutter
@XueshiQiao
XueshiQiao / gource.sh
Last active Nov 10, 2019 — forked from cgoldberg/gource.sh
Generate a MP4 Video for your Git project commits using Gource!
View gource.sh
# 1.install gource using HomeBrew
$ brew install gource
# 2.install avconv
git clone git://git.libav.org/libav.git
cd libav
# it will take 3-5 minutes to complie, be patient.
./configure --disable-yasm
make && make install