Skip to content

Instantly share code, notes, and snippets.

View seancheung's full-sized avatar
😅

Sean seancheung

😅
  • Hangzhou, Zhejiang/China
View GitHub Profile
@dentechy
dentechy / WSL-ssh-server.md
Last active March 30, 2024 16:16
A step by step tutorial on how to automatically start ssh server on boot on the Windows Subsystem for Linux

How to automatically start ssh server on boot on Windows Subsystem for Linux

Microsoft partnered with Canonical to create Bash on Ubuntu on Windows, running through a technology called the Windows Subsystem for Linux. Below are instructions on how to set up the ssh server to run automatically at boot.

  1. Edit the /etc/ssh/sshd_config file by running the command sudo vi /etc/ssh/sshd_config and do the following
    1. Change Port to 2222 (or any other port above 1000)
    2. Change PasswordAuthentication to yes. This can be changed back to no if ssh keys are setup.
  2. Restart the ssh server:
    • sudo service ssh --full-restart
  3. With this setup, the ssh server must be turned on every time you run Bash on Ubuntu on Windows, as by default it is off. Use this command to turn it on:
@Richard-Mathie
Richard-Mathie / Redis Cluster Setup with Docker Swarm.md
Last active May 11, 2022 12:58
Redis cluster setup with docker swarm

Redis Cluster Setup with Docker Swarm

Setup

./redis.sh

Test

test the redis cluster

@arturokunder
arturokunder / README.md
Created October 6, 2016 18:25
Verify APK signature

Do I have the correct certificate to sign my APK?

Use keytool Keytool is part of Java, so make sure your PATH has Java installation dir in it.

Get APK Certificate Signature

First, unzip the APK and extract the file /META-INF/ANDROID_.RSA (this file may also be CERT.RSA or something.RSA, but there should only be one .RSA file).

Then, run:

@coolaj86
coolaj86 / tcp-http-spy.js
Last active October 16, 2020 07:11
Raw TCP and TLS to HTTP and HTTPS in node.js
'use strict';
var net = require('net');
var http = require('http');
var http80 = http.createServer(function (req, res) {
res.end('Hello, World!');
});
var tcp80 = net.createServer(function (client) {
@enoch85
enoch85 / mysql_secure.sh
Last active August 24, 2019 03:08 — forked from Mins/mysql_secure.sh
Automating mysql_secure_installation for MySQL 5.7
#!/bin/bash
aptitude -y install expect
// Not required in actual script
MYSQL_ROOT_PASSWORD=abcd1234
SECURE_MYSQL=$(expect -c "
set timeout 10
@kjs3
kjs3 / server.js
Created December 3, 2015 20:26
Reloading express routes/middleware on file change WITHOUT restarting node process.
if ( process.env.NODE_ENV === 'production' ) {
// dev runs with babel-node so this isn't necessary
require('babel-core/register'); // this includes the polyfill
require('newrelic');
}
import 'source-map-support/register'
import Debug from 'debug'
import express from 'express'
@etes
etes / pi_mount_usb.md
Last active April 27, 2024 06:11
How to setup mount / auto-mount USB Hard Drive on Raspberry Pi

How to setup mount / auto-mount USB Hard Drive on Raspberry Pi

Follow the simple steps in the order mentioned below to have your USB drive mounted on your Raspberry Pi every time you boot it.

These steps are required especially if your are setting up a Samba share, or a 24x7 torrent downloader, or alike where your Raspberry Pi must have your external storage already mounted and ready for access by the services / daemons.

Step 0. Plug in your USB HDD / Drive to Raspberry Pi If you are using a NTFS formatted drive, install the following

@alexandru-calinoiu
alexandru-calinoiu / gist:451bb7cdaa1e67111ae7
Last active January 29, 2022 05:04
Send a CURL get request with an array param
This took me longer that I will like to find out
curl "http://localhost:3000/v1/collections/42/items?fields[]=synopsis" -v -H "Content-Type: application/json" -H "X-Session-Token: xxx" --globoff
@kristopherjohnson
kristopherjohnson / dlog.h
Last active January 19, 2021 02:52
DLog/ALog/ULog macros for Objective-C, from http://overbythere.co.uk/blog/2012/01/alternatives-nslog
// Original source for DLog/ALog/ULog: http://overbythere.co.uk/blog/2012/01/alternatives-nslog
// Log in DEBUG build only
#ifdef DEBUG
# define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
#else
# define DLog(...)
#endif
// Always log
@pyrtsa
pyrtsa / version.bash
Last active March 23, 2023 06:47
Xcode: Set version and build number from Git
#!/bin/bash
# Xcode: Set version and build number from Git
# --------------------------------------------
#
# This script sets the version number `CFBundleShortVersionString` to one of
#
# - `1.2.3` -- for the tagged commit `v1.2.3` or a hyphen-separated prerelease,
# e.g. `v1.2.3-alpha`, `v1.2.3-alpha.2`, `v1.2.3-beta`, `v1.2.3-rc`.
# - `1.2.3-7-gabc1234` -- at commit `abc1234`, 7 commits after `v1.2.3`,
# - `1.2.3-7-gabc1234-dirty` -- when there are uncommitted changes, or