Skip to content

Instantly share code, notes, and snippets.

View Gitart's full-sized avatar
🎨
Working from home

Arthur Savage Gitart

🎨
Working from home
  • ART TECH
  • Ukraine
  • 02:25 (UTC +03:00)
View GitHub Profile
@Gitart
Gitart / 0_reuse_code.js
Last active August 29, 2015 14:15
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@Gitart
Gitart / replaceall.go
Created October 29, 2016 15:30
Replace all
// Source: https://gist.github.com/tdegrunt/045f6b3377f3f7ffa408
// Example: replaceall.exe -find="cordove" -replace="gowebapp" -extension="*.go" -filename=true -write=false
package main
import (
"flag"
"fmt"
"io/ioutil"
@Gitart
Gitart / primecounter.go
Created October 29, 2016 15:30
Prime counter
/*
I was able to achieve these speeds on my laptop: Intel Core i7-4500U @ 1.80GHZ
2015/08/20 09:28:05 Test 1: 664579 took 47.0074ms
2015/08/20 09:28:05 Test 2: 5761455 took 626.9954ms
2015/08/20 09:28:13 Test 3: 50847534 took 8.0860009s
*/
package main
import (
@Gitart
Gitart / md5.go
Created October 29, 2016 15:31
Md5
package main
// Source: https://www.socketloop.com/tutorials/how-to-generate-checksum-for-file-in-go
import (
"crypto/md5"
"fmt"
"io"
"math"
"os"
@Gitart
Gitart / unxcommand.sh
Created October 29, 2016 15:32
unx command
# Find all files containing text
grep -Ril "text to find" /
# Write test to file using sudo
echo 'This is the test.' | sudo tee /etc/configfile
# Send a log using curl
curl -X POST -T file.txt https://example.com/file_upload;
# Check supported ciphers on server
@Gitart
Gitart / simpleservice.go
Created October 29, 2016 15:33
Simple service
package main
import (
"fmt"
"log"
"net/http"
"os"
"strings"
"time"
@Gitart
Gitart / godownload.go
Created October 29, 2016 15:33
Download
package main
import (
"io/ioutil"
"log"
"net/http"
"os"
"path/filepath"
"strings"
)
@Gitart
Gitart / appworker.go
Created October 29, 2016 15:34
App worker
package main
/*
Run and it will create appmaster.exe which will create a new appworker.exe if it is shutdown.
Must delete appmaster.exe before each run.
Only tested on Windows.
Should build with: -ldflags -H windowsgui
*/
import (
@Gitart
Gitart / sshaclient.go
Created October 29, 2016 15:34
Ssha client
package main
import (
"bufio"
"io/ioutil"
"os/signal"
//"syscall"
"fmt"
"log"
"os"
@Gitart
Gitart / ws.go
Created October 30, 2016 10:05
Websocket
package main
import (
"fmt"
"code.google.com/p/go.net/websocket"
)
const message = "Hello world"
func main() {