Skip to content

Instantly share code, notes, and snippets.

@gboudreau
gboudreau / AuthyToOtherAuthenticator.md
Last active March 28, 2024 20:53 — forked from Ingramz/AuthyToOtherAuthenticator.md
Export TOTP tokens from Authy
@abdennour
abdennour / README.md
Last active March 28, 2024 20:53
Nginx Reverse Proxy for Nexus Docker Registries

Overview

This is a solution of a common problem with Nexus Docker repositories. The administrator has to expose port for "pull", another port for "push", other ports for each hosted repository. This solution is about leveraging Nginx reverse proxy to avoid using these ports.

How it works ?

Given :

  • Nexus hostname is "nexus.example.com"
  • Nexus web port is 8081
@mikowl
mikowl / oneliners.js
Last active March 28, 2024 20:52
👑 Awesome one-liners you might find useful while coding.
// Inspired by https://twitter.com/coderitual/status/1112297299307384833 and https://tapajyoti-bose.medium.com/7-killer-one-liners-in-javascript-33db6798f5bf
// Remove any duplicates from an array of primitives.
const unique = [...new Set(arr)]
// Sleep in async functions. Use: await sleep(2000).
const sleep = (ms) => (new Promise(resolve => setTimeout(resolve, ms)));
// or
const sleep = util.promisify(setTimeout);
@styblope
styblope / docker-api-port.md
Last active March 28, 2024 20:51
Enable TCP port 2375 for external connection to Docker

Enable TCP port 2375 for external connection to Docker

See this issue.
Docker best practise to Control and configure Docker with systemd.

  1. Create daemon.json file in /etc/docker:

     {"hosts": ["tcp://0.0.0.0:2375", "unix:///var/run/docker.sock"]}
    
@dafurman
dafurman / GQL+Conveniences.swift
Created March 29, 2023 19:42
Apollo GraphQLNullable Conveniences
import ApolloAPI
import Foundation
public extension EnumType {
var gqlEnum: GraphQLEnum<Self> {
GraphQLEnum(self)
}
/// Converts an `EnumType` into a `GraphQLNullable<GraphQLEnum<EnumType>>` for compatibility with GQL query and mutation inputs.
var gqlEnumNullable: GraphQLNullable<GraphQLEnum<Self>> {
@RDeluxe
RDeluxe / sentry.ts
Created January 19, 2021 10:42
Sentry Interceptor for Nestjs
///// SERVICE
import { Injectable } from '@nestjs/common';
import * as Sentry from '@sentry/node';
import config from '../../config';
import { SentryEntry } from './sentry.interceptor';
@Injectable()
export class SentryService {
private isInit = false;
@edersohe
edersohe / arch-linux-install-notes.txt
Last active March 28, 2024 20:48
Install arch linux connect to WPA wireless from Arch Linux iso
loadkeys es
curl -o notes -L https://git.io/Jt8bu
#1) Get wifi devices
iwconfig
#2) Scannig available wifi networks with specific device, in my case wlan0
iwlist wlan0 scan | grep ESSID
@diego3g
diego3g / settings.json
Last active March 28, 2024 20:48
VSCode Settings (Updated)
{
"workbench.startupEditor": "newUntitledFile",
"editor.fontSize": 14,
"editor.lineHeight": 1.8,
"javascript.suggest.autoImports": true,
"javascript.updateImportsOnFileMove.enabled": "always",
"editor.rulers": [80, 120],
"extensions.ignoreRecommendations": true,
"typescript.tsserver.log": "off",
"files.associations": {
@shafik
shafik / WhatIsStrictAliasingAndWhyDoWeCare.md
Last active March 28, 2024 20:47
What is Strict Aliasing and Why do we Care?

What is the Strict Aliasing Rule and Why do we care?

(OR Type Punning, Undefined Behavior and Alignment, Oh My!)

What is strict aliasing? First we will describe what is aliasing and then we can learn what being strict about it means.

In C and C++ aliasing has to do with what expression types we are allowed to access stored values through. In both C and C++ the standard specifies which expression types are allowed to alias which types. The compiler and optimizer are allowed to assume we follow the aliasing rules strictly, hence the term strict aliasing rule. If we attempt to access a value using a type not allowed it is classified as undefined behavior(UB). Once we have undefined behavior all bets are off, the results of our program are no longer reliable.

Unfortunately with strict aliasing violations, we will often obtain the results we expect, leaving the possibility the a future version of a compiler with a new optimization will break code we th

@lopspower
lopspower / README.md
Last active March 28, 2024 20:45
Hexadecimal color code for transparency

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

Download This sample on Google Play Store