This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func BenchmarkPool(b *testing.B) { | |
var p sync.Pool | |
b.RunParallel(func(pb *testing.PB) { | |
for pb.Next() { | |
p.Put(1) | |
p.Get() | |
} | |
}) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// A dummy struct | |
type Person struct { | |
Name string | |
} | |
// Initializing pool | |
var personPool = sync.Pool{ | |
// New optionally specifies a function to generate | |
// a value when Get would otherwise return nil. | |
New: func() interface{} { return new(Person) }, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/bash | |
echo -e "\nHidden=true\n" | sudo tee --append /etc/xdg/autostart/tracker-extract.desktop /etc/xdg/autostart/tracker-miner-apps.desktop /etc/xdg/autostart/tracker-miner-fs.desktop /etc/xdg/autostart/tracker-miner-user-guides.desktop /etc/xdg/autostart/tracker-store.desktop > /dev/null | |
gsettings set org.freedesktop.Tracker.Miner.Files crawling-interval -2 # Default: -1 | |
gsettings set org.freedesktop.Tracker.Miner.Files enable-monitors false # Default: true | |
tracker reset --hard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import requests | |
import json | |
import base64 | |
user = 'USERNAME' | |
token = 'WWWW WWWW WWWW WWWW WWWW WWWW' # auth. token from application-passwords plugin | |
apiVer = 'v2' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def should(sample, conditions, min_should): | |
return True if len([item for item in conditions if item in sample]) >= min_should else False |
NewerOlder