Skip to content

Instantly share code, notes, and snippets.

Hunor Kovács kovacshuni

Block or report user

Report or block kovacshuni

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@kovacshuni
kovacshuni / main.go
Created Oct 20, 2019
generate-password-hash-scrypt
View main.go
package main
import (
"fmt"
"math/rand"
"os"
"time"
"golang.org/x/crypto/scrypt"
)
View githelp.txt
Don't let me Google that for you :P
The Git reference: git checkout --help
Pushing
Recommended pushing method
git push <remote> sourceBranch
example: git push origin master
Push current branch to the same name. It's ok. Make sure you're there, where you think.
git push origin HEAD
View feedingPrintingChannels.go
package main
import (
"fmt"
"time"
)
func main() {
q := make(chan string, 1)
View CPU-MIPS.txt
Intel i7 5820K 33126 MIPS ~ 2^15 MIPS (million instructions per second) = 2^35 IPS
Intel i7 6700K 25475 MIPS ~ roughly rounding up kind-of gives you the same
View test-server.go
package main
import (
"fmt"
"log"
"net/http"
"net/http/httputil"
"github.com/gorilla/mux"
)
View c17e8abe-1df8-11e7-942c-4a4c42b3072e-native.json
{"attributes":"\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003c!DOCTYPE ObjectMetadata SYSTEM \"/SysConfig/Classify/FTStories/classify.dtd\"\u003e\u003cObjectMetadata\u003e\n \u003cEditorialDisplayIndexing\u003e\n \u003cDILeadCompanies/\u003e\n \u003cDITemporaryCompanies\u003e\n \u003cDITemporaryCompany\u003e\n \u003cDICoTempCode/\u003e\n \u003cDICoTempDescriptor/\u003e\n \u003cDICoTickerCode/\u003e\n \u003c/DITemporaryCompany\u003e\n \u003c/DITemporaryCompanies\u003e\n \u003cDIFTSEGlobalClassifications/\u003e\n \u003cDIStockExchangeIndices/\u003e\n \u003cDIHotTopics/\u003e\n \u003cDIHeadlineCopy\u003eBarclays shares climb as Exane sees good news in history\u003c/DIHeadlineCopy\u003e\n \u003cDIBylineCopy\u003eBryce Elder\u003c/DIBylineCopy\u003e\n \u003cDIFTNPSections/\u003e\n \n \n \u003cDIFirstParCopy\u003eUK stocks slip to their worst weekly perfo
View SomeResourceCounter.go
type SomeResource struct {
counter int
}
func (sr *SomeResource) incCounter(rw http.ResponseWriter, r *http.Request) {
sr.counter++
}
func (sr *SomeResource) getCounter(rw http.ResponseWriter, r *http.Request) {
v := strconv.Itoa(sr.counter)
@kovacshuni
kovacshuni / scala-akka-streams-concurrent-requests.scala
Last active Mar 22, 2017
scala-akka-streams-concurrent-requests
View scala-akka-streams-concurrent-requests.scala
Source(List("/", "/docs"))
.map(theUri => HttpRequest(uri = theUri))
.via(Http().outgoingConnection("akka.io").async)
.mapAsyncUnordered(2)(r => r.entity.toStrict(2 seconds))
.map(e => e.data.utf8String)
.fold(List[String]())(_ :+ _)
.runWith(Sink.head)
.onComplete(logger.info("{}", _))
View hightlighting-tid
'notifications-monitor':
'patterns': [
{
'match': '^(tid_.*) ()'
'name': 'keyword.tid'
}
]
@kovacshuni
kovacshuni / simple.c
Created Mar 1, 2017
kill-daemon-process-test
View simple.c
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main(int argc, char **argv) {
printf("Hello from the parent process!\n");
pid_t pid = fork();
if (pid == -1) {
perror("fork failed");
exit(-1);
You can’t perform that action at this time.