View Minesweeper Master - Greenkey's solution
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
"""Usage: | |
X.py < X.in > X.out | |
""" | |
################################################################################ | |
# util functions | |
logging = False |
View elementary_setup.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
open_browser () { | |
URL=$1 | |
[[ -x $BROWSER ]] && exec "$BROWSER" "$URL" | |
path=$(which xdg-open || which gnome-open) && exec "$path" "$URL" | |
echo "Can't find browser" | |
} | |
View backup.bash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
while IFS=, read -r from to | |
do | |
echo copying from $from to $to | |
cp -vufr "$from" "$to" 2>> ~/cperrors.txt | |
done <<EOF | |
/home/myuser/important_files/,/media/myuser/externalHD/backup/important_files | |
/home/myuser/another_dir/,/media/myuser/externalHD/backup/another_dir | |
EOF |
View renameImage.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# usage: | |
# $0 path/to/image/or/dir path/to/destination/dir | |
# | |
# the file will be renamed using EXIF data: | |
# YYYYMMDD-image_name | |
# | |
# if the second parameter is specified, a directory structure will be created: | |
# path/to/destination/dir/YYYY/YYYY-MM/image_new_name |
View ssh-regsrv.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ ! -f ~/.ssh/id_rsa.pub ]; then | |
ssh-keygen | |
fi | |
echo "Server host:" | |
read SRV | |
echo "User on the server host:" |
View export_schema.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set long 10000000 | |
set head off | |
set echo off | |
set pagesize 0 | |
set verify off | |
set feedback off | |
SET LINESIZE 32000 | |
COL ddl FORMAT A32000 | |
spool schema.sql |
View Oracle_String_To_Array_and_Query.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE | |
a dbms_utility.uncl_array; | |
len PLS_INTEGER; | |
input_string STRING(999) := '0099905666,0099905667,0099905668,0099905669'; | |
my_code STRING(99); | |
BEGIN | |
-- add a letter to make it works | |
input_string := 'x' || Replace(input_string,',',',x'); | |
-- convert the string in an array | |
dbms_utility.Comma_to_table(input_string, len, a); |
View urlencode.vbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' Encode special characters of a string | |
' this is useful when you want to put a string in the URL | |
' inspired by http://stackoverflow.com/questions/218181/how-can-i-url-encode-a-string-in-excel-vba | |
Public Function URLEncode( StringVal ) | |
Dim i, CharCode, Char, Space | |
Dim StringLen | |
StringLen = Len(StringVal) | |
ReDim result(StringLen) |
View waitUntilSQL.vbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' executes the query to the DB while the results is not as expected | |
' the query MUST return at least one record with a field named CHECK_VAL | |
' the loop will stop when CHECK_VAL = check_val (Function parameter) | |
' or when the timeout is reached (milliseconds) | |
' the return value will be True (check ok) or False (timeout reached) | |
' waitBetweenQueries is the milliseconds to wait between the query execution | |
Function waitUntilSQL(connection, sql, check_val, timeout, waitBetweenQueries) | |
Dim response, startTime | |
' default values | |
If IsEmpty(timeout) Then timeout = 60000 |
View proxied_chrome.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
PROXY_IP=192.168.1.100 | |
PROXY_PORT=4444 | |
ssh -N -D $PROXY_PORT $PROXY_IP & | |
ID=$! | |
chromium-browser --proxy-server="socks://127.0.0.1:$PROXY_PORT" | |
kill $ID |
OlderNewer