Skip to content

Instantly share code, notes, and snippets.

@JalfResi
JalfResi / create-usb.sh
Created March 1, 2021 08:34 — forked from bmatcuk/create-usb.sh
Creating a Bootable Windows USB from ISO on a Mac
# First, we need to find our device. BEFORE inserting your USB drive, run the
# following:
diskutil list
# This will output a bunch of info about all of the disk drives connected to
# your Mac. Each entry will have a header in the form "/dev/diskX", where X is
# some number starting at 0. Now, insert your USB drive and run the command
# again. You should see a new entry. Make note of the name (ie, /dev/diskX).
diskutil list
@JalfResi
JalfResi / logger.go
Created February 2, 2017 21:40
Golang HTTP Handler request/response logger
func logger(prefix string, h http.Handler) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
// Save a copy of this request for debugging.
requestDump, err := httputil.DumpRequest(r, false)
if err != nil {
log.Println(err)
}
log.Println(prefix, string(requestDump))
@JalfResi
JalfResi / config.xml
Created January 25, 2017 12:02
Magento H&O Import example
<config>
<modules>
<MyModule_ImportCustomers>
<version>0.1.0</version>
</MyModule_ImportCustomers>
</modules>
<global>
<helpers>
<MyModule_ImportCustomers>
<class>MyModule_ImportCustomers_Helper</class>
@JalfResi
JalfResi / gist:54aecca6a64d76081f1a
Created June 25, 2015 15:10
Otto JS Plugin - The JavaScript
var getKeys = function(obj){
var keys = [];
for(var key in obj){
keys.push(key);
}
return keys;
}
function checkRequest(r) {
console.log(r);
@JalfResi
JalfResi / gist:fcd68104a284c3bf640d
Created June 25, 2015 15:06
Otto JS Plugin - expose host object to JS
package main
import (
"bytes"
"fmt"
"log"
"os"
"github.com/robertkrimen/otto"
)
package httpclient
import (
"net"
"net/http"
"time"
)
type Config struct {
ConnectTimeout time.Duration
@JalfResi
JalfResi / Channel Stack
Created September 19, 2014 11:30
Scaleable Channel Stack with workers
package main
import (
"log"
"sync"
)
// ***************************
type Worker chan struct{}
@JalfResi
JalfResi / killchanlist
Created September 18, 2014 13:34
Kill Channel List
package main
import (
"log"
"sync"
)
type List struct {
sync.Mutex
chans []chan struct{}
@JalfResi
JalfResi / revprox.go
Last active April 23, 2024 10:29
Simple reverse proxy in Go
package main
import(
"log"
"net/url"
"net/http"
"net/http/httputil"
)
func main() {
@JalfResi
JalfResi / gotour-69.go
Last active December 10, 2015 00:39 — forked from kylelemons/gotour-69.go
package main
import (
"os"
"fmt"
"runtime"
)
type Fetcher interface {
// Fetch returns the body of URL and