Skip to content

Instantly share code, notes, and snippets.

@so0k
so0k / Parse.ps1
Last active August 29, 2015 14:27
Read csv, parse HTML contained in csv field & return div elements of specific class exported as new csv
Function Get-FileName {
[System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms") | Out-Null
$OpenFileDialog = New-Object System.Windows.Forms.OpenFileDialog
$OpenFileDialog.initialDirectory = $initialDirectory
$OpenFileDialog.filter = "Comma Separated files (*.csv)| *.csv"
$OpenFileDialog.ShowDialog() | Out-Null
$OpenFileDialog.filename
}
$Input = Get-FileName
@so0k
so0k / S3-Angular-client.js
Last active October 27, 2015 04:16
S3 upload sample
function getS3Config() {
return Restangular.one(URLS.GET_S3_CONFIG).get();
}
//function with s3Config & angular $upload module injected
$upload.upload({
url: protocol + '://' + s3config.bucket + '/',
method: method.POST,
data: {
'key': funcs[i],
@so0k
so0k / eraser\chat.db
Last active October 1, 2015 02:10
counter-strike [POD] and quake 2 [ERASER] bot chat
# Eraser Bot chat data
#
# Thanks to Meanstryk for the additions
# -> http://www.planetquake.com/ramshackle
# Also thanks to Shawn "Benighted1" Lisk for more additions
# -> kclisk@bright.net
#
# OK, here's the deal. Bot's can say one of the following things:
#
# 1. Greetings
@so0k
so0k / sshcommand.sh
Created January 3, 2016 13:59
sshcommand.sh
#!/bin/bash
set -e
shopt -s nocasematch #For case insensitive string matching, for the first parameter
SELF=`which $0`
case "$1" in
create) # sshcommand create <user> <command>
if [[ $# -ne 3 ]]; then
@so0k
so0k / gist:cdd24d0a4ad92014a1bc
Last active March 4, 2024 14:17
droplet discovery over digitalocean private networks

Digital Ocean recently released private networking support in their NYC2 Data center.

They also published a blog post on how to setup a new droplet with private networking. But one thing the post doesn't do is tell you how to scale your private network for many boxes. One approach is obviously to edit /etc/hosts (but this gets annoying when you add a new box). A better way is to create an internal DNS zone (via the digital ocean web interface) and have your droplets use it:

Steps

setup the internal DNS zone file

  1. Login to digital ocean
  2. Click "DNS" on the right hand menu
@so0k
so0k / README.md
Last active April 27, 2016 22:10

Docker Tallinn Demo script

Ensure swarm cluster is started before start of demo script

Docker CLI

Using Beta Docker for Windows

@so0k
so0k / aws-docs-original.md
Last active June 28, 2016 08:19
AWS Docs clarification

Orig AWS Documentation:

url

You can enable query logging for your PostgreSQL DB instance by setting two parameters in the DB parameter group associated with your DB instance: log_statement and log_min_duration_statement. The log_statement parameter controls which SQL statements are logged. We recommend setting this parameter to all to log all statements; the default value is none. Alternatively, you can set this value to ddl to log all data definition language (DDL) statements (CREATE, ALTER, DROP, etc.) or to mod to log all DDL and data modification language (DML) statements (INSERT, UPDATE, DELETE, etc.).

The log_min_duration_statement parameter sets the limit in milliseconds of a statement to be logged. All SQL statements that run longer than the parameter setting are logged. This parameter is disabled and set to minus 1 (-1) by default. Enabling this parameter can help you find unoptimized queries.

@so0k
so0k / config.cfg
Last active January 4, 2017 14:43
unbindall
bind "0" "slot10"
bind "1" "slot1"
bind "2" "slot2"
bind "3" "slot3"
bind "4" "slot4"
bind "5" "slot5"
bind "9" "slot9"
bind "a" "+duck"
bind "b" "slot8"
@so0k
so0k / powerline.md
Last active September 18, 2020 14:04

Powerline

http://powerline.readthedocs.io

 mkdir powerlineFonts
 cd powerlineFonts/
 git init
 git remote add origin https://github.com/powerline/fonts.git
 git remote -v
@echo off
:: BatchGotAdmin
:-------------------------------------
REM --> Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
echo Requesting administrative privileges...