• Categories
    • Unread
    • Recent
    • Popular
    • Users
    • Groups
    • Register
    • Login
    1. Home
    2. Scuzz
    3. Topics
    Offline
    • Profile
    • Following 0
    • Followers 3
    • Topics 91
    • Posts 375
    • Groups 1

    Topics

    • ScuzzS

      First bit of Python in a long time

      Watching Ignoring Scheduled Pinned Locked Moved Development and Coding
      4
      4 Posts
      181 Views
      AlmostA
      Maybe they expected you to do two passes? def satisfiesF(L): x = [] for item in L: if f(item): x.append(item) for item in x: L.remove(item) return len(L) Seems like a bad question to me. If we’re going with the second interpretation (where you return a new list) I think this would work: def satisfiesF(L): return [x for x in L if f(x)]
    • ScuzzS

      Kodi addons

      Watching Ignoring Scheduled Pinned Locked Moved General Computing
      3
      3 Posts
      217 Views
      ScuzzS
      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.
    • ScuzzS

      [Spoilers?]Star wars

      Watching Ignoring Scheduled Pinned Locked Moved The lounge
      6
      6 Posts
      314 Views
      ScuzzS
      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.
    • ScuzzS

      [Python] Twitter controlled LEDs

      Watching Ignoring Scheduled Pinned Locked Moved Development and Coding python twitter led arduino
      8
      8 Posts
      1k Views
      SchamperS
      I did something similar back with Boblight a year or 2 ago. Had it working with configurable lighting effects and Facebook/Email too. https://www.youtube.com/watch?v=RM946iXWEx8 The lighting transition was generated as well since Boblight only took byte streams and didn’t know about any effects. Kind of related to this, I currently have my Hyperion set up with 2 different sources, Kodi and an USB video grabber but I needed a way to easily switch them. My first solution was to create a Kodi plugin that I could control using a simple HTTP request. It worked but was tedious. I recently learned about the existence of cec-client and it’s monitoring mode, so I whipped up a bash script that monitors the CEC traffic and changes Hyperion sources based on my AV receiver’s source. All configurable too. The only other thing I want now is to be able to change the HDMI OUT mode of my receiver but apparently that’s impossible using CEC. There’s an undocumented command you can send over telnet to do it though but I don’t want to get another ethernet cable there.
    • ScuzzS

      Virtual Desktops

      Watching Ignoring Scheduled Pinned Locked Moved General Computing
      7
      7 Posts
      968 Views
      AlmostA
      Not a huge fan of win+number. It’s an awkward hand position, it doesn’t help when I have > 10 windows (which might be a bit abnormal, admittedly), and it makes me think about which position the program I want is in (Yes, I know it’s simple and I can look at my task bar, but it’s still an amount of cognizant effort which is general something you want to avoid when designing a UI). 4 finder sliding would be the same effort if I had one desktop per app, which I wouldn’t. Chrome and coding would each have their own since they take a lot of screen real estate. Slack, telegram, terminal would all be on the same desktop. Anything else would be on a 4th. Plus, generally most of my time is on the web browser so if I then had code to its right, chat to its left, and everything else 2 to the left, it would be an average of like 1.5 swipes to get to what I want and a real max of 3. With tabbing it would probably have the same average, but a real max of 10. The number version would have an average of 1 and a max of 1, but takes more thought and doesn’t work with large numbers of open programs. Lastly, I think the 4 finger swipe is the most natural hand position.
    • ScuzzS

      Who is upgrading to Windows 10?

      Watching Ignoring Scheduled Pinned Locked Moved General Computing windows 10 upgrade
      16
      16 Posts
      2k Views
      theDaftDevT
      I had to force the install since it was taking forever to begin automatically. I think the whole thing is pretty neat. Would like to try Cortana as well, but the french speech recognition isn’t a thing yet :(
    • ScuzzS

      Show off your phone

      Watching Ignoring Scheduled Pinned Locked Moved Tech
      4
      4 Posts
      585 Views
      AlmostA
      Nah, the categories make it work really well. There’s only one section that doesn’t show completely on 1 page, and it only has 1 hidden row.
    • ScuzzS

      [Spoilers] Game of Thrones

      Watching Ignoring Scheduled Pinned Locked Moved The lounge game of thrones
      10
      10 Posts
      1k Views
      ScuzzS
      That Jon Targaryen though
    • ScuzzS

      BitBangermobiles

      Watching Ignoring Scheduled Pinned Locked Moved The lounge cars
      6
      6 Posts
      799 Views
      S
      [image: Lancaster_Gate_tube.jpg] Tube crew report in. There is however have a nice 2012 Mitsubishi Evo 10 RS parked in my drive, if only it were mine. I’ll get some pictures tomorrow.
    • ScuzzS

      Dedicated Minecraft statistic page

      Watching Ignoring Scheduled Pinned Locked Moved Gaming minecraft
      11
      11 Posts
      1k Views
      ScuzzS
      I have made some changes to the MC server. I have lowered the amount of ram being used as there are not many people playing on it. 1GB should be enough for just @Almost :P My mates have asked me to try and run an Ark server, this needs like 5GB ram to work. I’m gonna try run that for a while and see how it runs. If it gets too much for the server then I will remove it and raise the Minecraft ram back up to about 3GB.
    • ScuzzS

      Mazda MX5 flash to pass mod

      Watching Ignoring Scheduled Pinned Locked Moved The lounge mazda mx5 miata eunos flashtopass
      3
      3 Posts
      989 Views
      ScuzzS
      10/10 would read again.
    • ScuzzS

      Heroes of the Storm Closed Beta

      Watching Ignoring Scheduled Pinned Locked Moved Gaming heroes of the s beta
      3
      3 Posts
      603 Views
      SchamperS
      @CoDeZmAsTeR0800 generally your beta progress gets wiped.
    • ScuzzS

      Setting up Flask to work with Nginx

      Watching Ignoring Scheduled Pinned Locked Moved General Computing flask nginx python uwsgi
      1
      1 Posts
      459 Views
      ScuzzS
      After struggling for a few hour last night to get a working hello world with Flask and Nginx I think I should get a little guide up to make it a bit more clear. There are a few tutorials on various blog sites but non of them seemed to work correctly. Some had conflicting information and other had bits of code or config files that did not seem relevant. Even the Flask documentation was hard to understand and didn’t seem to work. I assume that you already have Nginx, Python and pip installed. Flask Flask is a lightweight web framework for Python. It is based on Werkzeug and Jinja 2. It is easy to install and run. You must have python and pip installed first before you can install Flask. To install you just run pip install Flask from your command line. For a quick demo, create a hello.py and copy in the following code: from flask import Flask app = Flask(__name__) @app.route("/") def hello(): return "Hello World!" if __name__ == "__main__": app.run() Then type python hello.py and visit http://localhost:5000 to see your first Flask hello world app. More information can be found on the Flask Website I have installed Flask in a virtual environment. To do this you will need to run pip install virtualenv. Create your directory for you app and run virtualenv venv, venv can be any name you want but I kept it simple. To activate the virtual environment run source venv/bin/activate. This will activate your virtual environment. From here you will install Flask with the same command as above, pip install Flask. If you have created the hello.py file from above you should be able to run this from within the virtual environment and check http://localhost:5000 to see it running. Run deactivate from within the virtual environment to deactivate it. uWSGI Nginx is a web server that serves static files. It is unable to serve a python application. This is where uWSGI comes in. You will require build-essential and python-dev for uWSGI. Run pip install uwsgi to install uWSGI. Open up your config file in the sites-available directory inside your Nginx installation and copy in the following: server { listen 80; server_name localhost; charset utf-8; client_max_body_size 75M; location / { try_files $uri @yourapplication; } location @yourapplication { include uwsgi_params; uwsgi_pass unix:/var/www/demoapp/demoapp_uwsgi.sock; } } Changing the path to your apps path. You will no need to create the .ini file for you application. Create a yourapp.ini file in the directory your application is located in. Copy in the following: [uwsgi] #application's base folder base = /var/www/demoapp #python module to import app = hello module = %(app) home = %(base)/venv pythonpath = %(base) #socket file's location socket = /var/www/demoapp/%n.sock #permissions for the socket file chmod-socket = 666 #the variable that holds a flask application inside the module imported at line #6 callable = app #location of log files logto = /var/log/uwsgi/%n.log Make sure to change the paths to be the correct paths for your app location. Create the log file directory. Now run uwsgi --ini /path/to/your/yourapp.ini. Now if you open your domain name that is linked to your app you should see that the app has loaded and “Hello World!” is displayed. This is a quick and dirty memory dump on what I did last night to get it running on my server. Hopefully it is easy enough to follow and is useful to some people.
    • ScuzzS

      A Song of Ice and Fire chapter summaries

      Watching Ignoring Scheduled Pinned Locked Moved The lounge chapter overview summary
      1
      1 Posts
      423 Views
      ScuzzS
      I have recently been meaning to finish off A Feast for Crows. I have read roughly half the book but that was some time a go. I can’t really remember what has happened. The Tower of the Hand has wonderful chapter summaries for every chapter of every book in the Song of Ice and Fire series. I have been thinking of a better way to read the chapter summaries off their website as reading them in on a PC or tablet via a web browser can be quite tiring on the eyes and sometimes quite difficult to navigate. I have created a PDF version of the chapter summaries of A Feast for Crows from The Tower of the Hand. This will allow people to add it to their kindles and ebook reader apps on their phones and tablets. Making it a lot better and easier to read. Hopefully I can create the PDF files for the other books too. A Feast for Crows chapter summary
    • ScuzzS

      NodeBB v0.6.x

      Watching Ignoring Scheduled Pinned Locked Moved Announcements nodebb upgrade
      2
      2 Posts
      800 Views
      ScuzzS
      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.
    • ScuzzS

      Cry of Fear Game Night [Weekend of 13th February 2015]

      Watching Ignoring Scheduled Pinned Locked Moved Gaming game night cry of fear
      4
      4 Posts
      703 Views
      ScuzzS
      Cry of Fear was a bit of a failure last night but we managed to rescue the game night with @GoaNy’s suggest of an online board game. Boardgame online It worked out to be quite an interesting and fun game to play. Definitely worth another go with some more people, I can imagine it being even more crazy than it was last night.
    • ScuzzS

      Game of Thrones Season 5 Trailer

      Watching Ignoring Scheduled Pinned Locked Moved The lounge game of thrones season 5
      6
      6 Posts
      890 Views
      SchamperS
      New trailer. I think this is the one that debuted at the Apple event yesterday. Although the Verge described it as Arya walking through an Apple store so I’m not too sure. https://www.youtube.com/watch?v=F9Bo89m2f6g
    • ScuzzS

      [C] Printer queue emulation with child processes

      Watching Ignoring Scheduled Pinned Locked Moved Development and Coding printe queue
      1
      1 Posts
      410 Views
      ScuzzS
      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); }
    • ScuzzS

      [nodebb-plugin-imdb] IMDB Information

      Watching Ignoring Scheduled Pinned Locked Moved Development and Coding nodebb imdb plugin
      14
      14 Posts
      2k Views
      AlmostA
      Look at you getting things to work! Nice job.
    • ScuzzS

      [nodebb-theme-classic] BitBangers Classic Theme

      Watching Ignoring Scheduled Pinned Locked Moved Development and Coding nodebb theme
      13
      13 Posts
      2k Views
      ScuzzS
      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; }
    • 1 / 1