sudo pacman -Suy rpmextract
wget https://www.kraxel.org/repos/jenkins/edk2/edk2.git-ovmf-x64-XXXXXX.noarch.rpm
# -*- coding: UTF-8 -*- | |
import sys | |
import socket | |
import sys | |
import socket | |
import time | |
def stringToDict(data): | |
arr = data.split('\r\n') | |
dick = {} |
package main | |
import ( | |
"log" | |
"sync" | |
"time" | |
) | |
const Limit = 5 |
/* | |
File that demostrates file descriptor leak | |
in case the client forgets to close response body | |
*/ | |
package main | |
import ( | |
"fmt" | |
"io/ioutil" |
type Storage interface { | |
Add(key, val string) | |
} | |
type SafeStorage struct { | |
storageMu *sync.Mutex | |
storage Storage | |
} | |
func NewSafeStorage(storage Storage) *SafeStorage { |
type Storage interface { | |
Add(key, val string) error | |
} | |
func (s *SafeStorage) Add(key, val string) error { | |
s.storageMu.Lock() | |
defer s.storageMu.Unlock() | |
return s.storage.Add(key, val) | |
} |
type storage struct{} | |
func (s *storage) Add(k, v string) {} | |
var s = NewSafeStorage(&storage{}) | |
func handleAdd(w http.ResponseWriter, r *http.Request) { | |
key := r.Host | |
value := r.Method | |
s.Add(key, value) | |
} |
type FailingStorage struct{} | |
func (f *FailingStorage) Add(k, v string) (err error) { | |
return errors.New("now we fail") | |
} | |
var s = NewSafeStorage(&FailingStorage{}) | |
func handleAdd(w http.ResponseWriter, r *http.Request) { | |
key := r.Host | |
value := r.Method |