Skip to content

Instantly share code, notes, and snippets.

View lucasew's full-sized avatar
🤓
Learning

Lucas Eduardo lucasew

🤓
Learning
  • Universidade Tecnológica Federal do Paraná
  • Santa Helena - PR
View GitHub Profile
@awidegreen
awidegreen / vim_cheatsheet.md
Last active June 17, 2024 03:41
Vim shortcuts

Introduction

  • C-a == Ctrl-a
  • M-a == Alt-a

General

:q        close
:w        write/saves
:wa[!]    write/save all windows [force]
:wq       write/save and close
@aviaryan
aviaryan / zsh-on-windows.md
Last active February 9, 2024 03:22
Installing zsh and oh-my-zsh on Windows
  1. Install zsh from cygwin
  2. Install oh-my-zsh from https://github.com/robbyrussell/oh-my-zsh . Follow the manual instructions
  3. To make zsh default on ConEmu, create a task with C:\cygwin64\bin\mintty.exe /usr/bin/zsh - . Make it the defaut shell.
  4. To start a zsh shell on demand, add this batch script to your path or start menu or wherever.
start C:\cygwin64\bin\mintty.exe /usr/bin/zsh -
@dflock
dflock / dark-theme.css
Created June 30, 2016 02:31
Dark theme for Just Read Chrome extension.
@font-face {
font-family: 'Source Sans Pro Semibold';
src: url("chrome-extension://dgmanlpmmkibanfdgjocnabmcaclkmod/fonts/SourceSansPro-Semibold.ttf");
}
@font-face {
font-family: 'Source Sans Pro Bold';
src: url("chrome-extension://dgmanlpmmkibanfdgjocnabmcaclkmod/fonts/SourceSansPro-Bold.ttf");
}
@font-face {
font-family: 'Source Sans Pro Light';
@dannguyen
dannguyen / sqlmd.sh
Last active June 13, 2022 20:05
A command-line function that runs a SQLite query and gets a Markdown-ready table; See console demo at https://asciinema.org/a/89573
### sqlmd
# Bash function for outputting SQLite results in Markdown-friendly table
### Dependency:
# csvlook can be found here: http://csvkit.readthedocs.io/en/540/scripts/csvlook.html
### USAGE
# $ sqlmd "SELECT name, age FROM people;" optional_db_name_argument.sqlite
### OUTPUT
@Maddosaurus
Maddosaurus / Alternative_Keypad.md
Last active February 9, 2021 01:02
Binding Multimedia keys in i3

Alternative bindings for the 540p using pactl and i3 - Keyboard

 # set laptop display to lower res - thats better
 exec  xrandr --output eDP1 --mode 1920x1080
 
 # set Numlock to on at login time
 exec --no-startup-id numlockx on
 
 # start pidgin on launch
@Pulimet
Pulimet / AdbCommands
Last active July 17, 2024 12:55
Adb useful commands list
adb help // List all comands
== Adb Server
adb kill-server
adb start-server
== Adb Reboot
adb reboot
adb reboot recovery
adb reboot-bootloader
@lheckemann
lheckemann / 0-readme.md
Last active March 11, 2024 13:11
Expression for a buildEnv-based declarative user environment.

Expression for a buildEnv-based declarative user environment

This is one way of managing your user profile declaratively.

Alternatives include:

  • an attrset-based nix-env-based environment, installed using nix-env -ir rather than nix-env --set. LnL has an overlay which shows a way of doing this.
  • home-manager, which provides NixOS-like config for your $HOME

Note that this is incompatible with regular imperative use of nix-env, e.g. nix-env -iA nixpkgs.hello. It has the advantage of allowing the installation of multiple outputs of the same package much better than nix-env's builtin profile builder does.

@rohan-molloy
rohan-molloy / 01-Network-Isolation-of-Services-with-Systemd.md
Last active July 9, 2024 23:47
This tutorial will look at how network namespaces can be defined in systemd service unit definitions

Network Isolation of Services with Systemd

Network namespaces are an important component of containerization in Linux. A network namespace (netns) allows a running process to see different network interfaces, routes, and firewall rules from the rest of the system. There are a number of use cases for network namespaces, such as running multiple servers, testing/staging environments and providing isolation of services.

Creating a Network Namepsace

We begin by creating a generic systemd service for creating a named network namespace. I add the following to /usr/lib/systemd/system/netns@.service. In systemd, the @ mean the service takes a parameter which is passed to the unit via %i. E.g, we can run sudo systemctl start netns@webserver.service.

@Muzietto
Muzietto / useDelayedEffect.js
Last active March 21, 2022 17:18
useDelayedEffect - using setTimeout in React functional components (custom hook)
import { useEffect, useRef } from 'react';
function useDelayedEffect(effect, changingStateVars = [], delay = 1000) {
const mutable = useRef();
const delayedEffect = () => {
mutable.current = setTimeout(effect, delay);
return () => {
clearTimeout(mutable.current);
@hizkifw
hizkifw / cloudflare-worker-youtube-dl.js
Last active July 13, 2024 21:37
Download YouTube videos with Cloudflare Worker
/**
* cloudflare-worker-youtube-dl.js
* Get direct links to YouTube videos using Cloudflare Workers.
*
* Usage:
* GET /?v=dQw4w9WgXcQ
* -> Returns a JSON list of supported formats
*
* GET /?v=dQw4w9WgXcQ&f=251
* -> Returns a stream of the specified format ID