Skip to content

Instantly share code, notes, and snippets.

Avatar

Nevzat ALKAN nevzatalkan

View GitHub Profile
View yahoo finance scrape with puppeteer
/**
* @name Download file / upload file
*
* @desc Find an image by class selector, downloads the image, saves it to disk and read it again. Use this together with a .fileUpload() method.
*
*/
const puppeteer = require('puppeteer')
const fs = require('fs')
const path = require('path')
View gist:cea844bb151746aed1097bd31354d4a0
udo apt-get update
sudo apt-get clean
sudo apt-get autoremove
sudo apt-get update && sudo apt-get upgrade
sudo dpkg --configure -a
View golang convert interface to map
package main
import (
"encoding/json"
"fmt"
)
func main() {
b := []byte(`{"key":"value"}`)
View ssh into vagrant go to project inside bash terminal
#! /bin/bash
cd /d/workspace/provisioning/vagrantfile/development
#more commands here
vagrant ssh -- -t 'cd /myworkspace; /bin/bash'
@nevzatalkan
nevzatalkan / rsync from osx
Created Aug 25, 2018
rsync from osx to linux
View rsync from osx
#install watchman
#install sshpass
#rsync1.sh
cd /Users/myuser
watchman-make --root ./myfolder -p='*' --run /Users/myuser/rsync2.sh
##########################
#rsync2.sh
sshpass -p "myPassword" rsync --recursive --delete --progress partial -avz /Users/myuser/myfolder remoteuser@remoteip:/remotefolder1/remotefolder2
@nevzatalkan
nevzatalkan / LogonAuthorize.cs
Created Dec 4, 2016
C# how to get the filled parameter names from request maching with the action parameters excluding default asp.net and http headers etc..
View LogonAuthorize.cs
public class LogonAuthorize : AuthorizeAttribute
{
var parameters = context.ActionDescriptor.GetParameters();
var contextParams = parameters.Select(s => s.ParameterName.ToLowerInvariant()).
Intersect(context.RequestContext.HttpContext.Request.Params.AllKeys.
Select(x=>!string.IsNullOrEmpty(context.RequestContext.HttpContext.Request.Params[x])
? x.ToLowerInvariant() : null));