I’m pretty sure you are the only one with negative rep.

Best posts made by Scuzz
-
RE: When Will You Notice Me?
-
Welcome to BitBangers.co.uk!
Welcome to BitBangers.co.uk!
BitBangers is a forum created by a few friends as a place to come and chat and discuss various topics that are of interest to us.
Previously we were members of a once large forum that dealt with memory modification of PlayStation Portable games. We created “cheat codes” for a vast amount of games, these cheat were anything from a simple infinite health code to a large anti-hack subroutine. For me, and I think many of the other members, this sparked off our path into computing, gaming, programming and technology in general.
Sadly that forum closed at the end of 2013 after a 7 year run; the casual members who still visited the forums had no where to go to keep in touch with each other and this is when BitBangers sprung to life.We took some time in finding the correct forum software for us, with previous experience with VBulletin and Xenforo we decided to go for something different and open source. After some research and testing we decided to use NodeBB as our main forum software. NodeBB is new, open source and different which filled our requirements perfectly. With NodeBB being open source it is a great way for us to get involved with the development. We have only been up and open a week or so and we have had a few changes added to the main NodeBB repo over at Github. @Schamper has even released a fully working shoutbox plugin which is great!
So, we’ve told you a bit about BitBangers, now it’s time for you to tell us a bit about yourself. Create a topic and introduce yourself!
-
[nodebb-plugin-imdb] IMDB Information
I am actually working on a NodeBB plugin. I know, I’m as shocked as you guys. Scuzz actually doing something productive.
The movie thread got me thinking about a plugin that would pull down some film information from IMDb, title, poster and a short plot when someone posts a link to an IMDb page.
I started working on this the other night and should have carried on last night but some Vodka took control and I kinda didn’t do anything.
Today have managed to get some regex working with the help of @Almost and @Schamper.
Currently I have some test code to select the ID of the film from an IMDb link and add it to a OMDb URL.The OMDb API is a free web service to obtain movie information, all content and images on the site are contributed and maintained by our users.
var omdurl; var html = 'dassdffdgf<a href="http://www.imdb.com/title/tt0816692/asdfsdfg">Interstellar</a>sfgfgsfgxxregadfsdfggrereaer'; omdburl = 'http://www.omdbapi.com/?i=' + html.split(/<a href="(?:https?:\/\/)?(?:www\.)?(?:imdb\.com)\/(?:title)\/(.+)\/.+">.+<\/a>/g)[1] + '&plot=short&r=json'; console.log(omdburl);
The link that is created returns a JSON object with a tone of information that can be used.
Tonight I will try and add this code to the code I already have working with a NodeBB instance. Then I will be looking into adding the content into an actual post.
-
[C] Printer queue emulation with child processes
Just showing another project I did while I was at Uni.
I dont know if it works, it should work as i submitted it as complete. But knowing me, i probably didnt care if it did work or not.
I’m pretty sure we had to emulate a printer queue. Each printer job was a child process.
Unix based OS only.Producer
Producer /* Some printf functions are comment out, these are for debuggin purposes. */ #include <stdio.h> #include <unistd.h> #include <sys/types.h> #include <sys/ipc.h> #include <sys/shm.h> void fChildProcess(); int main(int argc, char *argv[]) { if (argc != 3) //Error out if correct command isnt entered { printf("Usage: %s SizeOfQueue NumberOfJobs\n", argv[0]); exit(0); } int columns = 2; int rows; int row; int *matrix; int shmid; int i, k, j, iNoj, iSoq; iSoq = atoi (argv[1]); iNoj = atoi (argv[2]); if (iNoj > iSoq) //Error if number of jobs is > than the size of the queue { printf("Number of Jobs has to be less than the Size of queue\n"); exit(0); } FILE *fp; pid_t pid; key_t key; key = 1220; //Identifier for shared memory rows = iSoq; //Sets the rows in the shared memory to +1 so there is space for flags k = 1; /* Makes a file that has the size of the queue in it */ fp = fopen("size", "w"); fprintf(fp, "%d", rows); fclose(fp); shmid = shmget(key, sizeof(int)*rows*columns, IPC_CREAT | 0666); if(shmid < 0) { perror("shmget"); _Exit(1); } //printf("Segment created\n"); matrix = (int *)shmat(shmid, 0, 0); //Attatch matrix[0*2 + 0] = 0; // Read/write flag matrix[0*2 + 1] = 1; //printf("%d\t%d\n", matrix[0*2 + 0], matrix[0*2 + 1]); while(1) { //printf("WHILE LOOP\n"); if(matrix[0*2 + 0] == 0) { for(i = 0; i < iNoj; i++) { if(matrix[0*2 + 1] <= iSoq) { //printf("FOR LOOP\n"); pid = fork(); if(pid < 0) { printf("fork Error"); exit(1); } if(pid == 0) { fChildProcess(); } else { //printf("PARENT\n"); k = matrix[0*2 + 1]; matrix[k*2 + 0] = pid; //Adds PID to shared memory matrix[0*2 + 1]++; printf("PID %d added\n", matrix[k*2 + 0]); } } } //printf("SHARED MEM\n"); //for(i = 0; i < iSoq; i++) //{ //printf("%d\t%d\n", matrix[(i+1)*2 + 0], matrix[(i+1)*2 + 1]); //} matrix[0*2 + 0] = 1; } else { sleep(1); //Wait for consumer wait(1); //Wait for child process } } shmctl( shmid, IPC_RMID, 0 ); } void fChildProcess() { for(;;); //infinite loop, child process runs forever. }
Consumer
Consumer /* Some printf functions are commented out, they are used for debugging purpses*/ #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <sys/signal.h> #include <sys/types.h> #include <sys/ipc.h> #include <sys/shm.h> int main (int argc, char *argv[]) { if (argc != 2) //Errors out if correct arguments are not entered { printf ("Usage: %s AmmountToDelete\n", argv[0]); exit(1); } int rows; int columns = 2; int *matrix; int shmid; int i, j, iAtd; iAtd = atoi(argv[1]); FILE *fp; key_t key; //Opens the size file to get the size of the queue fp = fopen("size", "r"); fscanf(fp, "%d", &rows); fclose(fp); if(iAtd > rows) { printf("Please enter a number <= %d\n", rows); exit(0); } k = 0; key = 1220; shmid = shmget(key, sizeof(int)*rows*columns, 0666); if(shmid < 0) { perror("shmget"); //Error out if shared mem not found exit(EXIT_FAILURE); } printf("Segment found\n"); matrix = (int *)shmat(shmid, 0, 0); //Attatch //printf("Shared mem\n"); //for(i = 0; i < rows; i++) //{ // printf("SHARED MEM\n%d\t%d\n", matrix[i*2 + 0], matrix[i*2 + 1]); //} while(1) { if(matrix[0*2 + 0] == 1) { //printf("SHARED MEM BEFORE\n"); //for(i = 0; i < rows; i++) //{ // printf("%d\t%d\n", matrix[(i+1)*2 + 0], matrix[(i+1)*2 + 1]); //} //printf("KILLING PIDs\n"); for(i = 0; i < iAtd; i++) { if(matrix[(i+1)*2 + 0] > 0) { printf("KILLING\t%d\n", matrix[(i+1)*2 + 0]); kill(matrix[(i+1)*2 + 0], SIGTERM); //Kills the process printf("KILLED\t%d\n", matrix[(i+1)*2 + 0]); matrix[0*2 + 1]--; } } for(j = 0; j < matrix[0*2 + 1]; j++) { matrix[(j + 1)*2 + 0] = matrix[(j + 2)*2 + 0]; } //printf("SHARED MEM AFTER\n"); //for(i = 0; i < rows; i++) //{ // printf("%d\t%d\n", matrix[(i+1)*2 + 0], matrix[(i+1)*2 + 1]); //} matrix[0*2 + 0] = 0; } else { sleep(1); } } exit(0); }
-
The Walking Dead
What are your thoughts on The Walking Dead?
The mid season finale has been aired in the US and is going to air tonight in the UK. Have you been enjoying it or are you watching it just because you have seen all the other episodes and just want to know what happens?
When i first picked up the show a couple years ago I didn’t find it as good as people made it out to be. The first season was very meh to me. It all picked up in the second season. In my opinion it was the best season. The finale episode was so tense with Rick and Shane.
After that though I think it start to go down hill. It became slow and every episode seemed to make no progression to the story. To me it feels like the first episode, mid season finale, the first episode back after the break and then the last episode is all you need to watch to find out what has happened.All I can remember from the last season is them walking down that fucking railway for most the season and then when you expect it to get better and stuff starts happening its the last fucking episode. Cliff hanger. So now I want to know what happens and then have to watch the next season.
I don’t find the characters that good any more. I like how Rick is getting more and more “I DONT GIVE A FUCK” but that’s about it. I found the first bunch of character more likeable and I kinda felt something for them when one of them died or something bad happened. But now I don’t really care. The mid season finale for season 5 someone dies. I didn’t care. I felt kinda happy. We don’t have to put up with their shitty episodes any more.
I’m guessing next half will be more running through woods, finding food, running through woods, running through a town, zombies and then maybe some more evil people to deal with. I’m starting to think that Rick and friends are becoming the evil people now though.
This image is relevent to every episode and season imo
-
RE: [nodebb-plugin-imdb] IMDB Information
While testing out this API I have realised that IMDB does not allow hotlinking so the poster part of this plugin will have to wait until I can come up with a solution to include poster images.
In its current state the plugin will display a popover, similar to @Schamper user cards plugin, with the films title, rating, genre and small plot.
Like this:
Here is the code.
(function(window) { var urls; var href; var omdburl; var target; var regex = new RegExp('(?:https?:\/\/)?(?:www\.)?(?:imdb\.com)\/(?:title)\/(.+)\/', 'g'); function createOMDB(id){ var url = 'http://www.omdbapi.com/?i=' + id + '&plot=short&r=json'; return url; } function getFilmInfo(url, callback){ $.get(url, function(data){ //showPopover(JSON.parse(data), target); callback(JSON.parse(data), target); }); } function showPopover(filmData, target){ target.popover({ trigger: 'manual', placement: 'right', html: true, title: '<b>' + filmData.Title + '</b>', content: '<h5>Rating: '+ filmData.imdbRating +'</h5><h5>Genre: ' + filmData.Genre + '</h5><p>' + filmData.Plot + '</p>' }).popover('show'); } $(document).ready(function() { $(document).on('mouseenter', 'a', function(e){ target = $(e.currentTarget); href = $(this).attr('href'); while((urls = regex.exec(href)) !== null) { omdburl = createOMDB(urls[1]); getFilmInfo(omdburl, function(filmData, target){ showPopover(filmData, target); }); } }).on('mouseleave', 'a', function(){ target.popover('destroy'); }); }); })(window);
I think I may have the hang of callbacks but I’m not to sure at the moment, I did manage to implement one in the code though. I suppose that’s a start.
I have also notice a bug that when you mover your mouse over the link fast the popover will open but not close. You have to hover you mouse over the link again for it to be removed.
Also, bold title :P
-
Minecraft Server
@Almost has request a Minecraft server that we can all chill in from time to time.
We are now running a Minecraft 1.8 vanilla server.
I am considering a whitelist to stop people from fucking up shit. I really cant be bothered to get a server set up with hundreds of mods. I think we just want something that is nice, chill and no people messing with other peoples stuff.
IP - bitbangers.co.uk
Have fun and play nice :)
-
RE: What's up yall?
@Skyhijinx said:
I’m down to shoot the shit and talk about whatever else is going on though!
Pretty much what we only do here anyway :P
-
Arduino Powered PC Lighting
Over the last week or so I have been looking at either creating an Arduino controlled LED set up for my PC or an Ambilight for my TV.
I originally had the idea to have some individually programmable RGB LEDs inside my PC so I can change the colour scheme when I felt like it. I didn’t want to be tied down to blue, red or green.I was looking at the thin LED strips but the ones in my local electronic shop were not individually addressable and they were quite expensive.
After some research on different projects for PC lighting and Ambilights I decided to buy some WS2801 LEDs. These are RGB and are individually programmable, they are also slightly cheaper than the LED strip I saw at my local shop.When they arrived I was surprised by how big they actually are. Each LED has its own chip soldered next to it making them quite long.
50 LEDs seemed like a good amount at the time to fill my whole case with light but after testing them out it inside the case I found that they were too big and to spaced out to be of any use. Unless I can find a way to hide them, the wires, and have an even spread, I don’t think that they look ok inside my PC.https://www.youtube.com/watch?v=28G0CsNP6NU
Sorry for the crappy quality by my HTC One suffers from the purple tinge issue when in low light.
Latest posts made by Scuzz
-
RE: Some feedback from yesterday.
Yeah they are. We have one for private coding category.
-
RE: NodeBB v0.6.x
I’ve finally got round to upgraded to the latest version of NodeBB!
After spending days messing about trying to get the forums backup and and running i attempted to load our old database and user the latest version of NodeBB. And guess what? it worked!
Everything (mostly) is back to how it was before.
See you in another 10 years.
-
RE: First bit of Python in a long time
See, i kinda figured that out while i was testing some things.
It would print out incorrect data as the list was getting smaller, skipping some strings.I then tried with a second empty list that i then made L equal to. This would not modify L globally which is what this question wanted.
EDIT:
Modified the code to be what i think is “correct”
def f(s): return 'b' in s def satisfiesF(L): x = [] for item in L: if f(item): x.append(item) return x L = ['a', 'b', 'a', 'a', 'b', 'a','a', 'b', 'a',] L = satisfiesF(L) print len(L) print L
I think the example test code and the question are giving off the wrong idea as they want you to make global changes to L from within the function which can only be done via returning a value from the function. The test code says you need to return the length of L and make changes to L globally from within the function. You can use
global
to make global changes but doing this declares L as global and local which throws errors.Seems a shitty way of asking a question and using shitty example code?
def f(s): return 'a' in s L = ['a', 'b', 'a'] print satisfiesF(L) print L #Should print: #2 #['a', 'a']
-
First bit of Python in a long time
My manager’s son is learning Python and for some reason he thinks i’m a pro in Python.
His son is doing some online course and he was struggling with a question.def satisfiesF(L): """ Assumes L is a list of strings Assume function f is already defined for you and it maps a string to a Boolean Mutates L such that it contains all of the strings, s, originally in L such that f(s) returns True, and no other elements. Remaining elements in L should be in the same order. Returns the length of L after mutation """ # Your function implementation here run_satisfiesF(L, satisfiesF)
After a while I managed to get something working and it passed 100% when he submitted it.
def f(s): return 'a' in s def satisfiesF(L): for item in L: if not f(item) L.remove(item) return len(L) L = ['a', 'b', 'a', 'josh', 'gary', 'mark', 'dave', 'chris'] print satisfiesF(L) print L
-
RE: [nodebb-theme-classic] BitBangers Classic Theme
Here is all the css i have currently in the admin control panel. There are some changes I have made directly to some files. I think these changes are only background color and @brand-primary.
body { background: #f0f0f0; color: #888; } .shoutbox blockquote { padding: 5px; margin: 0px; font-size: medium; } .shoutbox .img-responsive { max-width: 200px; } .shoutbox-content { height: 250px; } .col-xs-12 { padding-left: 0px; padding-right: 0px; } .navbar-default { background-color: #dc3522; } .navbar-default .navbar-nav>li>a { color: #FFF; } .navbar-default .btn-link { color: #FFF; } .navbar-default .navbar-toggle .icon-bar { background-color: #FFF; } .navbar-default .navbar-toggle { border-color: #FFF; } .navbar-default .navbar-toggle:hover { background-color: #bd2e1d; } .row { margin-left: 0px; margin-right: 0px; } #nprogress .bar { background: #FFF; } #nprogress .spinner-icon { border-top-color: #FFF; border-left-color: #FFF; } .categories>li, .category>ul>li { padding: 20px; background: #FFF; border: 1px solid #e2e2e2; margin-bottom: 20px; -webkit-box-shadow: 0 0px 2px rgba(0, 0, 0, 0.1); -webkit-border-radius: 3px; overflow: hidden; } .categories-title { display: none; } .categories>li .card, .category>ul>li .card { border-left: 1px solid #e2e2e2; } .category>ul>li:not(.unread) h2 a { color: #dc3522 !important; } .category>ul>li:not(.unread) h2 a:hover { color: #bd2e1d !important; } .topic h1 { display: none; } .topic .posts>li { background: #FFF; border: 1px solid #e2e2e2; padding: 20px; margin-bottom: 20px; -webkit-box-shadow: 0 0px 2px rgba(0, 0, 0, 0.1); -webkit-border-radius: 3px; } .account .profile { background: #FFF; border: 1px solid #e2e2e2; padding: 20px; margin-bottom: 20px; -webkit-box-shadow: 0 0px 2px rgba(0, 0, 0, 0.1); -webkit-border-radius: 3px; } .posts-list { background: #FFF; border: 1px solid #e2e2e2; padding: 20px; margin-bottom: 20px; -webkit-box-shadow: 0 0px 2px rgba(0, 0, 0, 0.1); -webkit-border-radius: 3px; } .users-container { background: #FFF; border: 1px solid #e2e2e2; padding: 20px; margin-bottom: 20px; -webkit-box-shadow: 0 0px 2px rgba(0, 0, 0, 0.1); -webkit-border-radius: 3px; } .btn-primary { background-color: #dc3522; border-color: #dc3522; } .btn-primary:hover { background-color: #bd2e1d; border-color: #bd2e1d; } .btn-primary:focus { background-color: #bd2e1d; border-color: #bd2e1d; } .fab { background-color: #dc3522; } a { color: #dc3522; } a:hover { color: #bd2e1d; } .pagination>li>a, .pagination>li>span { color: #dc3522; } .pagination>.active>a, .pagination>.active>span, .pagination>.active>a:hover, .pagination>.active>span:hover, .pagination>.active>a:focus, .pagination>.active>span:focus { background-color: #dc3522; border-color: #dc3522; } .pagination>li>a:hover, .pagination>li>span:hover, .pagination>li>a:focus, .pagination>li>span:focus { color: #bd2e1d; }
-
RE: [nodebb-theme-classic] BitBangers Classic Theme
@hnkmaddox It’s taken me a looong time but i am slowly making changes.
The changes being made are a current mix of less edits and admin cp custom styles. I’ll get them all copied over to git as soon as i can. -
RE: Kodi addons
I installed genesis. Seems really useful although I have only watched a few episodes of Dr who.
The other one uses torrents and downloads then to the sdcard. I don’t think mine is big enough to handle them. I. Can’t remember what size if have.
-
RE: [Spoilers?]Star wars
I don’t know. It just seemed to be really cheesey like the conversations between the characters never seemed to have any detail to them.
They seemed to be the basic, minimal conversation so everyone could understand. Even a 5 year old.Also they all seemed to have some “comedy” moments.
I suppose I was expecting a slightly more serious film.