Skip to content

Instantly share code, notes, and snippets.

@adtac
adtac / Dockerfile
Last active May 28, 2024 01:38
#!/usr/bin/env docker run
#!/usr/bin/env -S bash -c "docker run -p 8080:8080 -it --rm \$(docker build --progress plain -f \$0 . 2>&1 | tee /dev/stderr | grep -oP 'sha256:[0-9a-f]*')"
# syntax = docker/dockerfile:1.4.0
FROM node:20
WORKDIR /root
RUN npm install sqlite3
@dentechy
dentechy / WSL-ssh-server.md
Last active June 13, 2024 15:17
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:
@0xjac
0xjac / private_fork.md
Last active June 18, 2024 22:39
Create a private fork of a public repository

The repository for the assignment is public and Github does not allow the creation of private forks for public repositories.

The correct way of creating a private frok by duplicating the repo is documented here.

For this assignment the commands are:

  1. Create a bare clone of the repository. (This is temporary and will be removed so just do it wherever.)

git clone --bare git@github.com:usi-systems/easytrace.git

import numpy as np
from scipy.stats import t, zscore
def grubbs(X, test='two-tailed', alpha=0.05):
'''
Performs Grubbs' test for outliers recursively until the null hypothesis is
true.
@rvagg
rvagg / v8-changelog-4.3+4.4.md
Created June 29, 2015 06:38
v8-changelog --trim --range '>=4.3 <4.5'

4.4.65 (2015-05-13)

  • Deprecate Isolate::New.
  • Factor out core of Array.forEach and .every, for use in TypedArrays (issue 3578).

4.4.63 (2015-05-11)

  • Let Runtime_GrowArrayElements accept non-Smi numbers as |key| (Chromium issue 485410).
@bwbaugh
bwbaugh / dnsmasq.conf
Last active November 6, 2023 17:02
Changing the DNS server on a RT-AC66U / RT-N66U
# Add these, though they didn't seem to take effect for me.
server=8.8.8.8
server=8.8.4.4
@mxwell
mxwell / convert_from_bt656.py
Created February 18, 2015 16:07
Script to extract a picture from a BT.656 frame
#! /usr/bin/python
###############################################################################
# Script converts a single frame, compliant with ITU-R BT.656-5,
# into a picture of given format (like PNG, JPEG, BMP, etc)
#
# Tested with Python 2.7.5, Pillow 2.7
###############################################################################
from PIL import Image
template<typename T>
class PersistentHandleWrapper {
public:
inline PersistentHandleWrapper()
: _isolate(nullptr) { }
inline PersistentHandleWrapper(v8::Isolate* isolate, v8::Local<T> value)
: _isolate(isolate),
_value(isolate, value) { }
@Mantish
Mantish / AuthController.js
Last active December 21, 2015 21:09 — forked from theangryangel/AuthController.js
Sails.js (v0.9.3) authentication using Passportmiddleware
// api/controllers/AuthController.js
var passport = require('passport');
var AuthController = {
login: function (req,res)
{
res.view();
},
@CMCDragonkai
CMCDragonkai / angularjs_directive_attribute_explanation.md
Last active November 29, 2023 15:35
JS: AngularJS Directive Attribute Binding Explanation

AngularJS Directive Attribute Binding Explanation

When using directives, you often need to pass parameters to the directive. This can be done in several ways. The first 3 can be used whether scope is true or false. This is still a WIP, so validate for yourself.

  1. Raw Attribute Strings

    <div my-directive="some string" another-param="another string"></div>