Skip to content

Instantly share code, notes, and snippets.

View 4Ply's full-sized avatar
:shipit:
Spinning up containers

Pawel 4Ply

:shipit:
Spinning up containers
View GitHub Profile
@leodutra
leodutra / -setup-windows-wsl-devenv.md
Last active June 10, 2024 03:25
Install and Setup Windows Subsystem 2 for Linux, Hyper, ZSH + Oh My Zsh + Powerlevel9k + plugins, FNM + VSCode (+ext) and Nerd Font

Setup Windows Subsystem 2 for Linux

Windows Subsystem 2 for Linux, Hyper, ZSH + Oh My Zsh + Powerlevel9k + plugins, FNM + VSCode (+ext) and Nerd Font

To setup native Linux, see this gist

Preview

Requirements

@miguelmota
miguelmota / command_exists.go
Last active February 15, 2024 09:29
Golang check if command exists
package main
import (
"log"
"os/exec"
)
func main() {
path, err := exec.LookPath("ls")
if err != nil {
@fourjr
fourjr / Discord Loading Lines.js
Last active June 28, 2022 08:16
loading lines
welcome messages: "https://gist.github.com/fourjr/0f47ce8a000c29cd4e24f8aeb7edd8e0"
Somewhere in 2020, they changed their loading lines to be more (professional?).
Ctrl+Shift+I > Application > Frames > top > Scripts > a3762dfb973e0a7a21ba.js > ctrl+f "LOADING_LINE" or https://canary.discordapp.com/assets/a3762dfb973e0a7a21ba.js
LOADING_LINE_1: "Discord was almost called Bonfire before we picked our name. It was meant to be nice and cozy.",
LOADING_LINE_2: "Discord was almost called Wyvern before we picked our name. Not too proud of that one.",
LOADING_LINE_3: "Our logo's name is Clyde.",
LOADING_LINE_4: 'There are a bunch of hidden "Easter Eggs" in the app that happen when you click certain things...', LOADING_LINE_5: "Discord started as a game company making a mobile game called Fates Forever.",
LOADING_LINE_6: "Discord’s official birthday is May 13, 2015.",
@mrcoles
mrcoles / unirest_promise.js
Created September 8, 2017 17:25
Node Unirest Promise Wrapper
function unirest_prom(unirest_req, always_resolve) {
// Returns a Promise by wrapping a unirest.Request object in
// a Promise that immediately calls `.end(...)`
//
// Params:
//
// * unirest_req - unirest.Request - any unirest Request object that has
// not yet had `.end(...)` called on it
// * always_resolve - bool (optional) - defaults to `false`, iff `true` then
// the Promise always resolves--even when the request fails
@0chroma
0chroma / VFIO Setup Guide.md
Last active March 12, 2024 13:49
Windows 10 VFIO QEMU Setup

VFIO Setup Guide

I play games regularly, and the sad reality is that it forces me to use Windows on my desktop. There's a Linux installation on there, but rebooting into it is such a massive interruption that I usually just move over to my laptop for programming. Working on a laptop leads to all sorts of ergonomic issues, and it felt like a massive waste to not develop on the desktop hardware I invested so much in. So after extensively researching what the VFIO community has been doing, I've deleted my Windows installation and moved all my gaming into a virtual machine on a Linux host.

Normally VMs are too slow for gaming, but thanks to a feature called VFIO you can run games at near-native performance by passing graphics cards and USB controllers directly to a virtual machine. The only requirement is that your board supports IOMMU, which most modern systems have. In this guide I'll wal

@avafloww
avafloww / PhpJava.java
Last active June 13, 2024 07:36
This snippet of code is syntactically valid in both PHP and Java, and produces the same output in both.
/*<?php
//*/public class PhpJava { public static void main(String[] args) { System.out.printf("/*%s",
//\u000A\u002F\u002A
class PhpJava {
static function main() {
echo(//\u000A\u002A\u002F
"Hello World!");
}}
//\u000A\u002F\u002A
PhpJava::main();
@mihkels
mihkels / MultiConnectionSupport.java
Created March 2, 2016 13:51
Spring Boot with Letsencrypt SSL certificate support
@Configuration
public class MultiConnectionSupport {
@Value("${server.port}")
private int serverPort;
@Value("${server.http.port}")
private int httpServerPort;
@Bean
public EmbeddedServletContainerFactory servletContainer() {
var http = require('http'),
https = require('https'),
httpProxy = require('http-proxy');
var caCert =
'-----BEGIN CERTIFICATE-----\n' +
'MIIDajCCAlICCQDgeRZY85PN7TANBgkqhkiG9w0BAQUFADB2MQswCQYDVQQGEwJV\n' +
'UzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZyYW5jaXNjbzEh\n' +
'MB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMRcwFQYDVQQDEw5EZW1v\n' +
'IEF1dGhvcml0eTAgFw0xNTA3MDQyMTQxNDlaGA8yMTE1MDYxMDIxNDE0OVowdjEL\n' +
@shamil
shamil / mount_qcow2.md
Last active June 17, 2024 17:27
How to mount a qcow2 disk image

How to mount a qcow2 disk image

This is a quick guide to mounting a qcow2 disk images on your host server. This is useful to reset passwords, edit files, or recover something without the virtual machine running.

Step 1 - Enable NBD on the Host

modprobe nbd max_part=8
@jasdeepkhalsa
jasdeepkhalsa / longPolling.js
Last active April 17, 2024 10:59
Simple Long Polling Example with JavaScript and jQuery by Tian Davis (@tiandavis) from Techoctave.com (http://techoctave.com/c7/posts/60-simple-long-polling-example-with-javascript-and-jquery)
// Long Polling (Recommened Technique - Creates An Open Connection To Server ∴ Fast)
(function poll(){
$.ajax({ url: "server", success: function(data){
//Update your dashboard gauge
salesGauge.setValue(data.value);
}, dataType: "json", complete: poll, timeout: 30000 });
})();