…where the name is made up of the date and time.
I’ve got a lot of image files that I tend to dump into whatever directory I feel like.
This simple python script will create directories and move files around based on the file name, as long as the filename follows the following format YYYYMM. Bascially as long as the first 6 characters are integers it should work. In my file system that’s fine In yours the same may not be true. If the first 6 characters is not an integer then it will leave them alone.
Notice I’m not checking for JPG/MP4 files only; I’m not checking that the year or month are valid values; I’m not checking the EXIF values and basing it on them if the filename is not valid; there are lots of really cool things I could do as well but I don’t need those because that’s how my files are set out. I’m not building in lots of features that don’t touch my use-case.
path = '/home/mike/TestPython/'
for file in os.walk(path):
for name in file:
year = name[:4]
month = name[4:6]
if not os.path.exists(year):
if not os.path.exists(year + "/" + month):
os.makedirs(year + "/" + month)
src = file + "/" + name
dst = path + year + "/" + month + "/"+name
Once you’ve moved all the files into their new homes delete all the empty directories. This code has been ever so slightly modifed from this StakOverflow post. It was modified for Python 3, by adding brackets to the print syntax:
currentDir = '/home/mike/TestPython/'
index = 0
for root, dirs, files in os.walk(currentDir):
for dir in dirs:
newDir = os.path.join(root, dir)
index += 1
print (str(index) + " ---> " + newDir)
print("Directory empty! Deleting...")
print("Directory not empty and will not be removed")
I love my phone. Having it means that I am rarely without a camera to take pictures of inane and awesome stuff. However I have very bad habits end up copying them more than once and putting them into all sorts of funny places. As a result my “Pictures” has a lot of duplicates. To clear up the duplicates I use a program called FSLINT.
Go here: https://unop.uk/dev/how-to-watch-bbc-news-videos-on-a-desktop-without-flash/
and here: http://www.howtogeek.com/113439/how-to-change-your-browsers-user-agent-without-installing-any-extensions/
basically create a new item in about:config called general.useragent.override and paste
Mozilla/5.0 (Linux; Android 4.4.4; en-us; Nexus 5 Build/JOP40D) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2307.2 Mobile Safari/537.36
sudo dnf install spacenavd
Once it’s installed run
sudo spacenavd -v -d
Run Blender and everything should be working as expected.
Top marks, Linux beats windows once again.
I had some trouble once I’d installed steam. It would fail to find the swrast driver. After some searching I found that the following command pulled through the required libraries:
sudo dnf install xorg-x11-drv-nvidia-libs.i686
This didn’t work quite so well on Fedora 23 so try this…
sudo dnf install nvidia-driver-libs
or use yumex-dnf to install nvidia-driver-libs.
After installing akmod-nividia package, you might run into a situation where you install a shiny new kernel but the akmod-nvidia package builds, but doesn’t install the drivers for the Kernel. To get it to install your built drivers do this:
cd /var/cache/akmods/nvidia; ls
sudo rpm -ivh kmod-nvidia-###########.rpm
sudo shutdown -r now
Where ############ is the latest number that corresponds to your new kernel number and the driver version.
You might want to check out the fail log to see why it failed. When this happened to me akmod had tried to install, but rpm was locked.
Emails from eBay members asking questions come through as firstname.lastname@example.org which can make them hard to count as a group
The following R script re-codes them so they can be counted.
inbox$EADD <- ifelse(grepl("members.ebay.co.uk",inbox$From...Address.),
f <- ddply(inbox,c("EADD"),summarize,N=length(EADD))
Once you’ve identified the biggest culprits, make a rule to move or delete them from your email.
This arrangement allows you to Empty on the right and send it to a box on the left.
Please note: On the collection point (right hand side) there is a Not Gate using a redstone torch.
using namespace std;
string binary( unsigned long n, int needlength );
unsigned long n=33;
unsigned long p=76;
int binarymax = 20;
int np = n & p;
int x = n ^ p;
int s = n | p;
int bitshift = n << 1;
cout<<"n= "<<n<<" sizeof: "<<sizeof(n)*8+1<<endl;
cout<<"p= "<<p<<" sizeof: "<<sizeof(p)*8+1<<endl;
cout<<" N = "<<binary(n,binarymax) <<" " << n <<endl;
cout<<" P = "<<binary(p,binarymax) <<" " << p <<endl<<endl;
cout<<" N & P = "<<binary(np,binarymax) <<" " << np <<endl;
cout<<" N or P = "<<binary(s,binarymax) <<" " << s <<endl;
cout<<"n xor p = "<<binary(x,binarymax) <<" " << x <<endl;
for (int i=0;i<10;i++)
cout<<"n xor p = "<<binary((n << i),binarymax) <<" " << (n << i) <<endl;
for (int i=0;i<10;i++)
n ^= i;
cout<<" n ^= "<<binary((n ),binarymax) <<" " << (n ) <<endl;
string binary( unsigned long g ,int needlength )
string str ="";
char resultArray[ (sizeof( g ) * 8) + 1 ]; //define an array that is big enough to hold the conversion. Assume this is because there are 8 bits in abyte and we get byte count for the variable type as a sizeof
unsigned index = sizeof( g ) * 8;
resultArray[ index ] = '\0'; //assign the end value to the string
resultArray[ --index ] = '0' + (g & 1); //count backwards and put the char value and 1 & the zero char value into the array
while(g >>= 1); //right bitwise operator
str=string(resultArray + index );
return strBin; //is this format something to do with returning a string??