Skip to content

Instantly share code, notes, and snippets.

View kapb14's full-sized avatar
😤

Aleksandr Karushin kapb14

😤
View GitHub Profile
@ymotongpoo
ymotongpoo / gist:1381882
Created November 21, 2011 06:57
convert PuTTy public key.
# convert PuTTY's public ssh key file into OpenSSH public key
ssh-keygen -i -f id_rsa_putty.pub > id_rsa.pub
@sunnyone
sunnyone / psxaml.ps1
Created June 11, 2012 04:53
PowerShell XAML Example
Add-Type -AssemblyName presentationframework
[xml]$XAML = @'
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="100" Width="20">
<StackPanel>
<TextBox Name="textWeather" />
<Button Name="buttonGet" Content="Get"/>
@alexnederlof
alexnederlof / selenium-start-stop.sh
Created November 20, 2012 19:49
Selenium start-stop script
#!/bin/bash
# Note that this script requires you to have
# an X window running on Display :90
# This can be done by running: /usr/bin/Xvfb :90 -ac -screen 0 1024x768x8 &
#
# You can save this script as /etc/init.d/selenium to start and stop selenium
PORT=4443
DESC="Selenium server"
@pklaus
pklaus / dnsupdate.py
Last active November 14, 2023 23:50
dnsupdate is meant to replace nsupdate, the standard DDNS update tool created by BIND authors ISC. While nsupdate does the job it is awkward to wrap in scripts and its usage in general is just not very intuitive. dnsupdate is meant to work well from the command line or from scripts and easy to use. It also does some nice things like automaticall…
#!/usr/bin/env python2.7
# Matt's DNS management tool
# Manage DNS using DDNS features
#
# See http://planetfoo.org/blog/archive/2012/01/24/a-better-nsupdate/
#
# Usage: dnsupdate -s server -k key -t ttl add _minecraft._tcp.mc.example.com SRV 0 0 25566 mc.example.com.
# -h HELP!
# -s the server
# -k the key
@mirontoli
mirontoli / AddLinksToCA.ps1
Created August 14, 2013 20:55
Add links into a Top Navigation Bar in SharePoint Central Admin
#Add links into a Top Navigation Bar in SharePoint Central Admin
if(-not(gsnp | ? { $_.Name -eq "Microsoft.SharePoint.PowerShell"})) { asnp Microsoft.SharePoint.PowerShell }
$url = "http://dev:2013"
$web = Get-SPWeb $url
$links = @{
"Farm Solutions" = "/_admin/Solutions.aspx"
"Service Applications" = "/_admin/ServiceApplications.aspx"
"Site Collection Owners" = "/_admin/owners.aspx"
"UPA" = "/_layouts/15/ManageUserProfileServiceApplication.aspx?ApplicationID=c32b96b6%2D7c34%2D4113%2D9982%2Df4e47aad1e50"
"SSA" = "/searchadministration.aspx?appid=5f037fe9-0cde-4bbb-a3a0-30f2605a0220"
@lizhiwei
lizhiwei / send_file_partial.py
Created December 10, 2013 04:20
HTTP 206 (Partial Content) For Flask
import mimetypes
import os
import re
from flask import request, send_file, Response
@app.after_request
def after_request(response):
response.headers.add('Accept-Ranges', 'bytes')
return response
@denji
denji / nginx-tuning.md
Last active November 5, 2024 10:10
NGINX tuning for best performance

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@orendon
orendon / xclip_ssh_rsa.sh
Last active September 29, 2023 22:52
linux copy ssh rsa key, xclip xsel pbcopy (clipboard)
xclip -sel clip < ~/.ssh/id_rsa.pub
# in case you get a display null error
DISPLAY=:0 xclip -sel clip < ~/.ssh/id_rsa.pub
# osx
pbcopy < ~/.ssh/id_rsa.pub
## Alternative
@dfinke
dfinke / CFSBuddy.ps1
Created September 17, 2014 14:37
PowerShell v5.0 ConvertFrom-String Buddy - A GUI that helps you work with this new powerful cmdlet
#Requires -Version 5.0.9814.0
if(!($PSVersionTable.PSVersion.Major -ge 5 -and $PSVersionTable.PSVersion.Build -ge 9814)) {
"Sorry you need PSVersion 5.0.9814.0 or newer"
$psversiontable
return
}
Add-Type -AssemblyName presentationframework
@Jaza
Jaza / Flask-blueprint-with-imported-routes
Last active March 10, 2024 18:26
Example of how to split a Flask blueprint into multiple files, with routes in each file, and of how to register all those routes.
*