Skip to content

Instantly share code, notes, and snippets.

View nevzatalkan's full-sized avatar

Nevzat ALKAN nevzatalkan

View GitHub Profile
@nevzatalkan
nevzatalkan / LogonAuthorize.cs
Created December 4, 2016 12:33
C# how to get the filled parameter names from request maching with the action parameters excluding default asp.net and http headers etc..
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));
@nevzatalkan
nevzatalkan / rsync from osx
Created August 25, 2018 21:58
rsync from osx to linux
#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
#! /bin/bash
cd /d/workspace/provisioning/vagrantfile/development
#more commands here
vagrant ssh -- -t 'cd /myworkspace; /bin/bash'
package main
import (
"encoding/json"
"fmt"
)
func main() {
b := []byte(`{"key":"value"}`)
udo apt-get update
sudo apt-get clean
sudo apt-get autoremove
sudo apt-get update && sudo apt-get upgrade
sudo dpkg --configure -a
/**
* @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')