Skip to content

Instantly share code, notes, and snippets.

Avatar
🍊
workin' goodly

Gianni Chiappetta gf3

🍊
workin' goodly
View GitHub Profile
@gf3
gf3 / boot options
Created May 27, 2020
Grub boot options (threadripper/nvidia)
View boot options
mce=off blacklist=nouveau modprobe.blacklist=nouveau
@gf3
gf3 / 81-disable-onboard-audio.rules
Created Apr 7, 2020
Linux on AMD TRX40 (Threadripper) and NVIDIA 2080ti RTX
View 81-disable-onboard-audio.rules
# /etc/udev/rules.d/81-disable-onboard-audio.rules
#
# Disable onboard Asustek USB audio device
SUBSYSTEM=="usb", ATTRS{idVendor}=="0b05", ATTRS{idProduct}=="1917", ATTR{authorized}="0"
@gf3
gf3 / main.rs
Created May 29, 2019
error[E0507]: cannot move out of borrowed content
View main.rs
extern crate unidiff;
use unidiff::PatchSet; // http://messense.github.io/unidiff-rs/unidiff/struct.PatchSet.html
pub struct Printer {
patch_set: PatchSet,
}
impl Printer {
pub fn new(source: &str) -> Self {
@gf3
gf3 / setup.sh
Last active Jan 22, 2019
Neovim config setup
View setup.sh
#!/bin/sh
# Install:
# curl -fsL https://gist.githubusercontent.com/gf3/3d90fd82deaa4cab19fb8d817a370e27/raw/setup.sh | sh
# Directories
mkdir -p ~/.local/share/nvim/{backup,swap,undo}
# Config
curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
@gf3
gf3 / README.md
Last active Jan 22, 2019
Docker: VPN + DNS Proxy + App
View README.md

Docker setup

Using the docker-compose.yml below as a template, replace the webapp section with your application.

VPN setup

Follow the setup guide here: https://github.com/kylemanna/docker-openvpn

Afterwards we'll want to modify the VPN config so that it points to our local DNS proxy.

@gf3
gf3 / uuid.ts
Created Feb 20, 2018
Generate a secure RFC4122-compliant v4 UUID
View uuid.ts
/**
* Convert a number or array of integers to a string of padded hex octets.
*/
function asHex(value: number[] | Uint8Array): string {
return Array.from(value).map(i => ('00' + i.toString(16)).slice(-2)).join('');
}
/**
* Attempt to securely generate random bytes/
*/
@gf3
gf3 / email-test.js
Last active Dec 21, 2017
Validate and correct misspelled emails using a fuzzy matcher
View email-test.js
/* eslint-env jasmine */
import { validate, suggest } from './email';
describe('email', () => {
describe('validate', () => {
it('should correctly validate correct email addresses', (done) => {
const promises = [
validate('user@gmail.com'),
validate('user+dix@host.ca'),
View keybase.md

Keybase proof

I hereby claim:

  • I am gf3 on github.
  • I am gf3 (https://keybase.io/gf3) on keybase.
  • I have a public key whose fingerprint is D428 D86A 63EB D5EC EE92 CE1F EA42 2CB5 194C F827

To claim this, I am signing this object:

@gf3
gf3 / Spotify.swift
Created Aug 29, 2017
Spotify ScriptingBridge from Swift
View Spotify.swift
import AppKit
import ScriptingBridge
@objc public protocol SBObjectProtocol: NSObjectProtocol {
func get() -> Any!
}
@objc public protocol SBApplicationProtocol: SBObjectProtocol {
func activate()
var delegate: SBApplicationDelegate! { get set }
@gf3
gf3 / iTunes.swift
Created Aug 29, 2017
iTunes ScriptingBridge from Swift
View iTunes.swift
import AppKit
import ScriptingBridge
@objc public protocol SBObjectProtocol: NSObjectProtocol {
func get() -> Any!
}
@objc public protocol SBApplicationProtocol: SBObjectProtocol {
func activate()
var delegate: SBApplicationDelegate! { get set }
You can’t perform that action at this time.