Skip to content

Instantly share code, notes, and snippets.

@dtrailin
dtrailin / loop break
Created July 31, 2012 01:28
Will this work
for (int x = 0; x < 6;x+=3 )
{
if (Grid[x+1] == Grid[x+2] && Grid [x+2] == 2 && Grid[x+3] == 0){
Grid[x+3] = 2;
break;
}
@dtrailin
dtrailin / AI logic
Created July 31, 2012 07:26
Logic for Tic Tac Toe AI
:
1. Check if there is a tile that you can win in 1 move
if there is no such tile:
2. Check if there is a tile that your opponent can win in 1 move
if there is no such tile:
3. Check if there is a tile that can make two tiles apply to the rule #1
if there is no such tile:
4. Check if there is a tile that your opponent can make two tiles apply to the rule #2
if there is no such tile:
@dtrailin
dtrailin / time.java
Created August 11, 2012 20:28
Time class
import java.util.Calendar;
import java.util.GregorianCalendar;
public class time {
private int hour, minute, second;
private static Calendar calendar;
public String time(boolean Mil) {
calendar = new GregorianCalendar();
@dtrailin
dtrailin / gist:3327311
Created August 11, 2012 21:07
Stuff working
nautilus smb://192.168.1.65
@dtrailin
dtrailin / passgen.sh
Created September 15, 2012 03:09
A password generator
list=`echo {0..9}`
for c1 in $list
do
for c2 in $list
do
for c3 in $list
do
for c4 in $list
do
for c5 in $list
@dtrailin
dtrailin / animate.sh
Last active April 2, 2018 04:44
Animation generation for bash
mkdir movie
cd movie
counter=0
while (( "$counter" < 360 ))
do
let counter=counter+1
convert -size 600x600 canvas:white $counter.jpg
mogrify -pointsize 40 -draw "text 300,300 'hello world'" -rotate $counter $counter.jpg
done
ffmpeg -f image2 -i %d.jpg animation.mpeg
@dtrailin
dtrailin / spam.sh
Created September 15, 2012 03:11
A spammer for bash
counter=0
while (( counter < 1000 ))
do
let counter=counter+1
xte 'str insert text here' 'key Return'
done
@dtrailin
dtrailin / imgdown.sh
Created October 6, 2012 06:37
Imgur downloader
function ImgurDir {
if [ -d ~/imgur\ albums ]
then
cd ~/imgur\ albums
else
mkdir ~/imgur\ albums
cd ~/imgur\ albums
fi
}
function readAlbum {
@dtrailin
dtrailin / Backround.sh
Created January 17, 2013 22:09
Change destop background in gnome 3
BACKGROUND_PATH="/home/denis/Pictures/AT_wallpapers/"
BACKGROUND_STYLE="scaled" ## 'zoom', 'tiled', 'scaled', 'stretched', 'centered'
CYCLE_TIME="300"
TEMP_LOG="/tmp/rotate${RANDOM}.log"
LOG="/tmp/.`whoami`-gnome-background-rotator"
##Write Date & Time to Log File
echo "-------------------------------------" > "${LOG}"
echo "`date +\%B\ \%d,\ \%Y`" >> "${LOG}"
echo "-------------------------------------" >> "${LOG}"
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->