Skip to content

Instantly share code, notes, and snippets.

View andykuszyk's full-sized avatar

andykuszyk

  • Deliveroo
  • Southampton, UK
View GitHub Profile
@andykuszyk
andykuszyk / remote-powershell.ps1
Created April 21, 2017 07:33
Remote powershell
$serverAddress = "1.1.1.1"
$userName = "user"
$securePassword = ConvertTo-SecureString -AsPlainText -Force -String "password"
$credentials = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $userName,$securePassword
$session = New-PSSession -ComputerName $serverAddress -Credential $credentials
Invoke-Command -Session $session -ScriptBlock {
Write-Host "hello world"
}
@andykuszyk
andykuszyk / linux-commands.md
Last active July 6, 2017 15:48
linux commands

See devices on local network

arp-scan --localnet

Check disk usage

du -h

Finding text in files

cat /path/to/file.txt | grep -o -P '.{0,3}string-to-match.{0,10}'

See first few lines in file

@andykuszyk
andykuszyk / jenkins-api-python.py
Created June 7, 2017 16:25
jenkins-api-python
import requests
requests.post('http://{}/job/{}/buildWithParameters?{}={}'.format(
jenkins_url,
job_name,
parameter_name,
parameter_value
))
@andykuszyk
andykuszyk / Setting up Cassandra for remote access.md
Last active March 6, 2025 18:26
Setting up Cassandra for remote access

Make these changes in the cassandra.yaml config file:

start_rpc: true

rpc_address: 0.0.0.0

broadcast_rpc_address: [node-ip]

listen_address: [node-ip]

@andykuszyk
andykuszyk / PIP release.md
Last active August 16, 2017 08:40
PIP release
  • Put setup files in root of repo
  • Put .pypirc in home folder
  • Run python setup.py sdist in repo dir
  • Run twine upload dist/* in repo dir
@andykuszyk
andykuszyk / Travis PyPi release.md
Created September 7, 2017 10:29
Travis PyPi release

Encrypt your PyPi password using:

echo -n "password1" | travis encrypt --add deploy.password

in your root dir.

.travis.yml

language: python
python:
import argparse
import datetime
import time
def date(arg):
return datetime.date.fromtimestamp(time.mktime(time.strptime(arg, '%d/%m/%Y')))
if __name__ == '__main__':
@andykuszyk
andykuszyk / Setting up Spark on Ubuntu in clustered environment.md
Last active December 5, 2018 19:04
Setting up Spark on Ubuntu in clustered environment

Setting up Spark on Ubuntu in clustered environment

Getting Spark and setting up user

sudo adduser spark
su spark
cd
wget http://apache.mirror.anlx.net/spark/spark-2.2.0/spark-2.2.0-bin-hadoop2.7.tgz
tar -xvf spark~
rm *.tgz
import falcon
import waitress
import json
class HelloWorldResource:
def on_post(self, req, resp):
content = req.stream.read().decode()
if content == 'spam':
resp.body = json.dumps('eggs')
@andykuszyk
andykuszyk / .vimrc
Last active May 29, 2019 08:47
vimrc
set tabstop=4 shiftwidth=4 expandtab
set number
autocmd Filetype go setlocal ts=4 sw=4 sts=0 noexpandtab
set nocompatible
filetype off
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize