Skip to content

Instantly share code, notes, and snippets.

View xyproto's full-sized avatar
😊

Alexander F. Rødseth xyproto

😊
View GitHub Profile
@lonelycode
lonelycode / pie_python_plugin.py
Last active August 29, 2015 14:22
A sample asynchronous RPC server plugin over STDIO in python for use with natefinch/pie Golang Plugin library.
#!/usr/bin/python
# Description: A sample asynchronous RPC server plugin over STDIO in python
from __future__ import print_function
import sys
import time
import pyjsonrpc
import threading
import Queue
@cszentkiralyi
cszentkiralyi / context_quick_scope.vim
Last active April 16, 2016 07:15
Only enable the quick-scope plugin's highlighting when using the f/F/t/T movements
" Insert into your .vimrc after quick-scope is loaded.
" Obviously depends on <https://github.com/unblevable/quick-scope> being installed.
" Thanks to @VanLaser for cleaning the code up and expanding capabilities to include e.g. `df`
let g:qs_enable = 0
let g:qs_enable_char_list = [ 'f', 'F', 't', 'T' ]
function! Quick_scope_selective(movement)
let needs_disabling = 0
@n3r0-ch
n3r0-ch / docker-nuke
Last active August 23, 2019 16:44
docker-nuke exists to do one thing; clean up your Docker environment. It's not called docker-carefully-and-nicely-spritz-up. Be carefully!
#!/bin/bash
#Check if user is root
if [ $UID != 0 ]; then
echo "You need to be root to use this script."
exit 1
fi
echo "docker-nuke exists to do one thing; clean up your Docker environment. It's not called docker-carefully-and-nicely-spritz-up. Be carefully!"
echo
@nilsdeppe
nilsdeppe / emacs.el
Last active June 7, 2020 16:31
My Emacs init file
;;; initfile --- Summary:
;;; Commentary:
;; Emacs 25.1 and newer tested
;;; Code:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Configuration/Customization:
;; Defines global variables that are later used to customize and set
;; up packages.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@deanishe
deanishe / edit_paths.zsh
Last active February 9, 2022 17:03
prepend_path and append_path functions for zsh
# The following functions append/prepend the specified directory to the path variable specified by name
# If the directory is already in the path, it is first removed and then appended/prepended.
# Examples:
#
# Prepend `~/bin` to `$PATH`:
# prepend_path PATH ~/bin
#
# Append `~bin` to `$PATH` instead:
# append_path PATH ~/bin
# (this will remove `~/bin` from the beginning of `$PATH` first)
@jdoig
jdoig / sdl_demo.fs
Created July 28, 2011 23:27
sdl demo using F#
#light
open SdlDotNet.Core;
open SdlDotNet.Graphics;
open SdlDotNet.Graphics.Sprites;
open SdlDotNet.Input;
open System.Drawing;
open System;
type StuperGario = class
val mutable location : Point
func Escape(sql string) string {
dest := make([]byte, 0, 2*len(sql))
var escape byte
for i := 0; i < len(sql); i++ {
c := sql[i]
escape = 0
switch c {
case 0: /* Must be escaped for 'mysql' */
@earthboundkid
earthboundkid / -Go iterator experiment.md
Last active July 25, 2023 17:28
Go iterator experiment

Go iterator proposal experiment

The second problem in Project Euler is

By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.

Nine years ago, I wrote a blog post that showed how to solve this in Python using iterators and in Go using channels. The Go code started simple, but ended up a bit complicated because it also had stop channels to allow early exit. See euler.py for the Python code, and channel.go for the Go code using channels.

Go issue #61405 proposes to add a new function-based iterator protocol to Go. To test it, I rewrote the Go code using push function iterators. See functional.go. The code is notably simpler and shorter than the channel based code.

@HarryUPf
HarryUPf / README.md
Last active September 28, 2023 01:37
Raspberry Pi SunVox Headless Synth (in 10 easy steps)

Raspberry Pi SunVox Headless Synth Setup (in 10-easy-steps)

INSTRUCTIONS

STEP_01

STEP_02

  • write the extracted .img to sdcard with Etcher

STEP_03

# Install these packages (use your favorite AUR tool here)
yay -S minikube kubectl docker-machine-driver-kvm2 libvirt qemu-headless ebtables
# Get libvirt going
sudo systemctl enable libvirtd.service
sudo usermod -a -G libvirt $(whoami)
# This fix thanks to http://blog.programmableproduction.com/2018/03/08/Archlinux-Setup-Minikube-using-KVM/
sudo virsh net-autostart default