Skip to content

Instantly share code, notes, and snippets.

Halil Kaskavalci kaskavalci

Block or report user

Report or block kaskavalci

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
kaskavalci / unique-strings.go
Created Jul 19, 2018
Remove duplicates from a string array in go
View unique-strings.go
func unique(tokens *[]string) {
v := reflect.ValueOf(tokens).Elem()
if v.Len() <= 1 {
i := 0
for j := 1; j < v.Len(); j++ {
if (*tokens)[i] == (*tokens)[j] {
kaskavalci / download.js
Created Mar 15, 2018
humble bundle download all
View download.js
// Execute this from browser console
// Tested on Chrome. Firefox does not work. Even pop-up blocker is disabled it still blocks opening new windows.
// Things to do:
// Enable option Download PDF files instead of automatically opening them in Chrome in chrome
// Allow popups
Array.from(document.querySelectorAll('a')).filter(a => a.hostname.startsWith('dl.')).map((v)=>{v.setAttribute('target','_blank'); v.classList.remove('a'); return v}).forEach(v=>{,'_blank'); console.log(v.href)})

Keybase proof

I hereby claim:

  • I am kaskavalci on github.
  • I am kaskavalci ( on keybase.
  • I have a public key whose fingerprint is E6F2 56B2 165E 1C63 2120 D327 1A9E 56C5 C682 88F3

To claim this, I am signing this object:

kaskavalci / pre-commit.bash
Created Jan 25, 2018
pre-commit hook for sqlinter
View pre-commit.bash
if [[ ! $(which gem) ]]; then
echo "You don't have gem installed. Go install it."
exit 1
if [[ ! $(which sqlint) ]]; then
gem install sqlint
git diff --cached --name-status | xargs -0 | while read st file; do
kaskavalci /
Created Sep 15, 2017
Untar all files in a directory to unique directories
# Change file extension if needed
for f in *.tgz ; do mkdir "${f%%.*}" && tar xzf $f -C "${f%%.*}" ; done
View nomad-consul-communication
~1�~�GET /v1/agent/services HTTP/1.1
Host: localhost:8500
User-Agent: Go-http-client/1.1
Accept-Encoding: gzip
l�$X �hh��`2@!4��7�,I4��u:
~1�~1�HTTP/1.1 200 OK
Content-Type: application/json
Date: Thu, 10 Nov 2016 18:46:04 GMT
##You better change these:
git config --global "Name Surname?"
git config --global ""
##Paste as it is
git config --global alias.s "status -suno"
git config --global alias.l "log --oneline --decorate"
Runnable runner = new Runnable() {
public void run() {
File index = new File(getMyURL());
if (index.exists()) {
View redirect_stdout.c
freopen("NUL", "a", stdout); //redirect stdout to null again
dup2(stdout_save, STDOUT_FILENO); //restore the previous state of stdout
setvbuf(stdout, NULL, _IONBF, MDT_BUFSIZE); //disable buffer to print to screen instantly
View save_stdout_status.c
int stdout_save;
char buffer[BIG_ENOUGH];
fflush(stdout); //clean everything first
stdout_save = dup(STDOUT_FILENO); //save the stdout state
freopen("NUL", "a", stdout); //redirect stdout to null pointer
setvbuf(stdout, buffer, _IOFBF, 1024); //set buffer to stdout
You can’t perform that action at this time.