Skip to content

Instantly share code, notes, and snippets.

View lauborges's full-sized avatar
💭
I may be slow to respond.

Lau Borges lauborges

💭
I may be slow to respond.
View GitHub Profile
@shivapoudel
shivapoudel / commands.sh
Last active October 8, 2019 13:07
Docker reset
docker system prune -f --volumes
docker container prune -f
docker container stop $(docker container ls -aq)
docker container rm $(docker container ls -aq)
docker image prune -f -a
docker volume prune -f
docker network prune -f
@xmeng1
xmeng1 / wsl2-network.ps1
Created July 14, 2019 06:50
WSL2 Port forwarding port to linux
$remoteport = bash.exe -c "ifconfig eth0 | grep 'inet '"
$found = $remoteport -match '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}';
if( $found ){
$remoteport = $matches[0];
} else{
echo "The Script Exited, the ip address of WSL 2 cannot be found";
exit;
}
@jessarcher
jessarcher / dslr-webcam.md
Last active March 10, 2024 17:25
Using my Canon 70D DSLR camera as a web cam on Linux

You'll need:

  1. Video 4 Linux loopback device kernel module (v4l2loopback) - Source: https://github.com/umlaeute/v4l2loopback (You might find builds in your distro's repos - I'm using Fedora so had to build it myself using https://github.com/danielkza/v4l2loopback-fedora/)
  2. gPhoto2 - this is what allows you to access your cameras live feed over USB - this was available in Fedora's repos.
  3. GStreamer or ffmpeg - this is what lets you stream the output from gPhoto2 into the loopback device.

It's been a little while since I set it all up so I can't remember all of the installation details, which will probably be different for your distro anyway unless you're using Fedora. Apologies if I have forgotten something as wel.

Running the stream

@EduVencovsky
EduVencovsky / Auth.jsx
Last active June 27, 2024 07:58
Private Routes with Auth using react-router and Context API
import React, { useState, useEffect } from 'react'
import PropTypes from 'prop-types'
import { checkIsAuthenticated, authSignUp, authLogin, authLogout } from '../../services/auth'
export const AuthContext = React.createContext({})
export default function Auth({ children }) {
const [isAuthenticated, setIsAuthenticated] = useState(false)
const [isLoading, setIsLoading] = useState(true)
@DavidWells
DavidWells / async-foreach.js
Created October 22, 2018 04:10 — forked from atinux/async-foreach.js
JavaScript: async/await with forEach()
const waitFor = (ms) => new Promise(r => setTimeout(r, ms))
const asyncForEach = (array, callback) => {
for (let index = 0; index < array.length; index++) {
await callback(array[index], index, array)
}
}
const start = async () => {
await asyncForEach([1, 2, 3], async (num) => {
await waitFor(50)
#!/bin/bash
# This script requires jq, a command line to to parse and format JSon.
# https://stedolan.github.io/jq/
function padBase64 {
STR=$1
MOD=$((${#STR}%4))
if [ $MOD -eq 1 ]; then
STR="${STR}="
@AveYo
AveYo / .. MediaCreationTool.bat ..md
Last active April 30, 2025 05:20
Universal MediaCreationTool wrapper for all MCT Windows 10 versions - MOVED TO github.com/AveYo/MediaCreationTool.bat
@Firsh
Firsh / lwp-cloudflare-dyndns.sh
Last active April 23, 2025 15:56
Cloudflare as Dynamic DNS
#!/bin/bash
# Cloudflare as Dynamic DNS
# From: https://letswp.io/cloudflare-as-dynamic-dns-raspberry-pi/
# Based on: https://gist.github.com/benkulbertis/fff10759c2391b6618dd/
# Original non-RPi article: https://phillymesh.net/2016/02/23/setting-up-dynamic-dns-for-your-registered-domain-through-cloudflare/
# Update these with real values
auth_email="[email protected]"
auth_key="global_api_key_goes_here"
zone_name="example.com"
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 8.
"type", "use", "zero-value"
"bool", "Boolean data type. It can store value `true` or `false`.", "false"
"string", "String data type. It can store UTF-8 string. All strings in go are UTF-8 by default. Unlike JavaScript, string is only encapsulated in double quotes.", "empty string"
"int", "Integer data type. It can store 32-bit or 64-bit signed integer. A 32-bit system will allocate 32 bits of memory and 64-bit system will allocate 64 bits of memory. Hence 32-bit system can store -2147483648 to 2147483647 and 64-bit system can store -9223372036854775808 to 9223372036854775807", "0"
"uint", "Integer data type. Same as `int`, `uint` can store 32 bits or 64 bits **unsigned** integer.", "0"
"int8", "Integer data type. System will allocate 8 bits of memory to store an integer. Hence it can store values between -128 to 127.", "0"
"uint8", "Integer data type. Same as `int8`, `uint8` can store 8-bit **unsigned** integer. Hence it can store values between 0 to 255.", "0"
"int16", "Integer data type. System will allocat
@superjose
superjose / .gitlab-ci.yml
Last active February 19, 2024 10:22
This is an example of a .gitlab-ci.yml that is required for Continuous Integration on GitLab projects.
# Reference: https://www.exclamationlabs.com/blog/continuous-deployment-to-npm-using-gitlab-ci/
# GitLab uses docker in the background, so we need to specify the
# image versions. This is useful because we're freely to use
# multiple node versions to work with it. They come from the docker
# repo.
# Uses NodeJS V 9.4.0
image: node:9.4.0
# And to cache them as well.