L0m
-
Posts
70 -
Joined
-
Last visited
Reputation Activity
-
L0m got a reaction from TheSLSAMG in Ebay Usb Wifi Adapter
Thanks, I think I'll reconsider, although I realised it was usb 2.0 I didn't realise it was 2.4 only
-
L0m reacted to theonlyratatoskr in No stereo mix in recording devices
The phrase is "to no avail".
As far as I know, there's no way to route one thing to two outputs within windows alone.
Maybe this will help though:
-
L0m reacted to Daniel du Toit in How do I share my VPN between 10 computers?
Craft Computing has a tutorial to VPN everything on your network. I implemented it on a Raspberry Pi B+.
-
-
L0m reacted to vorticalbox in Portfolio Suggestions?
just keep doing what you're doing, also get involved with other open source projects. releasing a pip package is also good.
The one thing i could say to improve you current projects is get some testing.
-
L0m reacted to Dat Guy in Portfolio Suggestions?
*g*
Make a website. Don't rely on Github. You'll find that you'll have a lot of other people's projects in your repository list really, really soon.
-
L0m reacted to Nettly_ in Portfolio Suggestions?
Good things to do:
- Keep GitHub repo of all code and projects
- Make a pip package
The first one is the best portfolio, but making a pip package is also decent
-
L0m reacted to vorticalbox in Portfolio Suggestions?
Take a look at
https://github.com/vorticalbox/json-mysql
Its wrote in node but if you look in my __tests__ folder you can see I am testing that my functions are doing what I am expecting them to so.
It's a way to prove your code is actually doing what it says.
Once set up you will very quickly know that your changes havent broken any existing code.
-
L0m got a reaction from Fredrik Svantesson in Are there any libraries for encrypting data in python?
Oh my god I suck at explaining things, that's exactly what I want to do. Let me rephrase the original post
-
L0m reacted to vorticalbox in Portfolio Suggestions?
Write unit tests to progtammatically prove your code is working as intended
-
L0m reacted to Fredrik Svantesson in Are there any libraries for encrypting data in python?
What kind of encryption? Encrypted zipfile? Encrypted folders like with BitLocker? A fully encrypted filesystem like ecryptfs? A fully encrypted block device like dmcrypt?
-
L0m reacted to Dat Guy in Under 50 Lines Challenge!!
You could have used one line less by not using the horrible "using namespace std;".
-
L0m reacted to KeyboardCowboy in Under 50 Lines Challenge!!
Sudoku game generator, 50 lines, simi standard formatting (not compressed?). More commenting this time.
/*----- keyboardCowboy | 8/8/19 | Sudoku Generator ------*/ #include <iostream> #include <stdlib.h> #include <time.h> #include <algorithm> #include <string.h> using namespace std; const int S = 9; //size of arrays int RND(int i){return rand()%i;} //random funk void mask(int G[S][S]){ //skill level mask int arr[S] = {1,1,1,1,0,0,0,0,0}; //skill = 4, change mask, 1 = blank (skill) for(int i = 0; i < S; i++){ random_shuffle(&arr[0], &arr[S], RND); //mix the mask for(int j = 0; j < S; j++) if(arr[j]) G[i][j] = 0;}}//write the mask void swapRC(int G[S][S], int a, int b, bool f){ //f=0, row | f=1, col int c = 0; //swaps rows&cols for(int i = 0; i < S; i++) f ? (c=G[i][a], G[i][a]=G[i][b], G[i][b]=c) : (c=G[a][i], G[a][i]=G[b][i], G[b][i]=c);} void mix(int G[S][S]){ //mixes rows and cols at random int a = rand()%1024; //max iterations is 1024 (make it bigger?) for(int i = 0; i < a; i++){ bool rc = (bool) rand()%2; //row/col bit int pik = rand()%3; //which row/col swapRC(G, (pik*3), (pik*3)+2, rc);}} //swap that shit! void shiftLeft(int arr[S], int steps){ //shifts array to the left x times for(int i = 0; i < steps; i++){ int c = arr[0]; for(int j = 0; j < S-1; j++) arr[j] = arr[j+1]; arr[S-1] = c;}} void init(int G[S][S]){ //init game board int cnt = 0, arr[S] = {1,2,3,4,5,6,7,8,9}; //base condition random_shuffle(&arr[0], &arr[S], RND); //mix base at random do{ for(int i = 0; i < S; i++) G[cnt][i] = arr[i]; (++cnt%3 == 0) ? shiftLeft(arr, 4) : shiftLeft(arr, 3); }while(cnt < S);} void dump(int G[S][S]){ //dumps the board for(int i = 0; i < S; i++){ for(int j = 0; j < S; j++) !G[i][j] ? cout << (char) 250 << " " : cout << G[i][j] << " "; cout << endl; }cout << endl;} int main(){ //main... its main int G[S][S] = {0}, K[S][S] = {0}; //2 game arrays, K=solution srand (time(NULL)); //init rand init(G); mix(G); memcpy(K, G, sizeof(K)); mask(G); //init, mix the 2d array, copy, then set skill mask cout << "Puzzle, Skill:4\n"; dump(G); //display game cout << "Press Return for Solution..."; cin.ignore(); //waits for user intervention cout << "\nSolution\n"; dump(K); //displays the solution return 0;} ScreenShot
-
L0m got a reaction from KeyboardCowboy in Under 50 Lines Challenge!!
Yeah after seeing these one liners I'm gonna edit the original post ?
-
L0m reacted to genxha in Raspberry pi button without breadboard
Simply connect 1 wire from button pin to ground and the other to any other pin except 3v/5v. For library you can use GPIOzero that's very good.
There's a LOT of projects on Google.
-
L0m got a reaction from vorticalbox in Under 50 Lines Challenge!!
Yeah after seeing these one liners I'm gonna edit the original post ?
-
L0m got a reaction from Dat Guy in Under 50 Lines Challenge!!
Yeah after seeing these one liners I'm gonna edit the original post ?
-
L0m reacted to Ja Krispie in Under 50 Lines Challenge!!
print("Hello World") <?php echo 'Hello World'; ?> Console.WriteLine("Hello World!"); #!/usr/bin/perl print "Hello World!\n"; puts 'Hello world!' I think I nailed it! ?
-
L0m reacted to KeyboardCowboy in Under 50 Lines Challenge!!
Sudoku game generator, 50 lines, compressed to 90 columns, prints in notepad++, within the margins. The program compiles and runs.
Formated
Screenshot
main.cpp.pdf
-
L0m got a reaction from KeyboardCowboy in Under 50 Lines Challenge!!
Try and make a program in any language that is under 50 lines of code* **
*Comments and White Lines included
** Standard formatting (so no super compacted 1-5 liners)
-
L0m reacted to vorticalbox in Under 50 Lines Challenge!!
stock prediction in pure JS nodeJs most of the lines are training data
bugger example you can see here
https://repl.it/@vorticalbox/stockPrediction
const brain = require('brain.js'); const trainingData = [ [{ open: 1.045509090909091, high: 1.063281818181818, low: 1.0419909090909092, close: 1.0563909090909092 }, { open: 1.0427181818181819, high: 1.0529818181818182, low: 1.0279, close: 1.0434545454545454 },], [ { open: 1.006318181818182, high: 1.0163454545454547, low: 1.000909090909091, close: 1.014590909090909 }, { open: 1.0052272727272726, high: 1.0177363636363637, low: 0.9999272727272728, close: 1.0137545454545456 } ] ] const test = [{ open: 1.0145454545454546, high: 1.0168545454545455, low: 1.0066090909090908, close: 1.0085454545454546 }, { open: 1.0008181818181818, high: 1.010218181818182, low: 0.9959999999999999, close: 1.0094272727272726 }] const net = new brain.recurrent.LSTMTimeStep({ inputSize: 4, hiddenLayers: [8, 8], outputSize: 4 }); net.train(trainingData, { learningRate: 0.005, errorThresh: 0.02, log: console.log, logPeriod: 100 }); const forecast = net.forecast(test, 3) console.log(forecast)
-
L0m got a reaction from Mad153 in is it worse to make your own encryption system
Another look at it is if your program stops working then you have another thing you'l need to troubleshoot, another point of failure as you will. Also if you were to deploy this program you'd rather not take the chance of your product failing because of a mistake you made.
IMO if you can pull it off just do it.
-
L0m reacted to vorticalbox in Under 50 Lines Challenge!!
Here is the one I wrote for work to merge CSVs with the same headers into a single CSV
node.
const fs = require('fs').promises; const csv = require('csvtojson'); const { parse } = require('json2csv'); const path = './csv'; const fields = ['id', 'firstname', 'lastname'] const opts = { fields }; const listFiles = (folder) => fs.readdir(folder); const loadCSV = (files) => Promise.all(files.map((file) => csv().fromFile(`${path}/${file}`))); const flattenArray = (arrays) => [].concat(...arrays); const parser = (items) => parse(items, opts) const save = (data) => fs.appendFile('merged.csv', data) listFiles(path) .then(loadCSV) .then(flattenArray) .then(parser) .then(save) .catch(console.error)
-
L0m reacted to mariushm in Under 50 Lines Challenge!!
Out of habit. I got used (as a sort of good practice) to always have < > != == or === in an if / while / do / loop / whatever, so while (true) while correct, just doesn't feel right to me.
Also, in php you may often be tempted to do if (!$variable) but that can be wrong, because you may want to do $variable===FALSE
In the case of the example above, in theory I think while(true) would be a few cpu cycles faster, but in practice I think the Zend engine (which converts the php script to bytecode) will optimize away the 1==1 to true anyway when the script is loaded, so the second time the while loop goes, the result is the same... it's like writing "true" there.
-
L0m reacted to mariushm in Under 50 Lines Challenge!!
just wrote it for fun...
tail - shows the last 512 bytes of a file and keeps showing what's added to the end of file ... useful to see web server/ftp logs or whatever as they're updated
php.exe tail.php "x:\path\to\filename.extension"
could be much smaller but has some added text on screen to remind user how to close it and show the app is still working (every 10s)
<?php if (count($argv)==1) die('usage : tail.php "filename.ext"'); $argv[0] = ''; $path = trim(implode(' ',$argv),'" '); $CRLF = chr(0x0D).chr(0x0A); echo 'Trying to open '.$path.$CRLF; $handle = fopen($path,'rb'); if (!$handle) die('Failed to open file.'); $finfo = fstat($handle); echo 'Filesize : '.$finfo['size'].' bytes. Press Ctrl+C to quit.'.$CRLF.$CRLF; $offset = $finfo['size'] - 512; $offset = $offset <0 ? 0 : $offset; $counter = 1; while (1==1) { $finfo = fstat($handle); if ($offset>$finfo['size']) $offset = $finfo['size']; if ($offset<$finfo['size']) { if ($counter>0) { echo $CRLF.$CRLF; $counter=1; } $ret = fseek($handle,$offset); $buffer = fread($handle,512); echo $buffer; $offset += strlen($buffer); } else { $counter++; } sleep(1); if ($counter % 10 == 0) echo $CRLF.date('H:i:s',time()).' Press Ctrl+C to quit.'; } ?>