acidphakist Posted April 7, 2011 Report Share Posted April 7, 2011 #!/usr/bin/python import wx import os class CustomApp(wx.App): def __init__(self): wx.App.__init__(self) self.value = None def SetValue(self, value): self.value = value def GetValue(self): return(self.value) class SearchObject: def __init__(self): self.tags = {} self.fileHandle = '' def SetTags(self,tagDict): self.tags = tagDict def SetFileHandle(self,fileHandle): self.fileHandle = fileHandle class PrintWindow(wx.Frame): def __init__(self,filterFixObjects,filterFixLines): self.filterFixObjects = filterFixObjects self.filterFixLines = filterFixLines wx.Frame.__init__(self,None,wx.ID_ANY, 'Order Search Results') for line in self.filterFixLines: print line class MainWindow(wx.Frame): def __init__(self,app): self.app = app wx.Frame.__init__(self,None,wx.ID_ANY, 'Order Search') self.panel = wx.Panel(self, wx.ID_ANY) title = wx.StaticText(self.panel,wx.ID_ANY) self.dirname = '' self.searchobject = SearchObject() filemenu= wx.Menu() menuOpen = filemenu.Append(wx.ID_OPEN, "&Open","Open a file to edit") self.Bind(wx.EVT_MENU, self.OnOpen, menuOpen) menuBar = wx.MenuBar() menuBar.Append(filemenu,"&Pick your fix logfile") self.SetMenuBar(menuBar) topSizer = wx.BoxSizer(wx.VERTICAL) bagSizer = wx.GridBagSizer(hgap=5, vgap=5) Thanks Haha Confused Sad Facepalm Burger Farnsworth Big Brain Like × Quote Hide acidphakist's signature Hide all signatures music Link to comment https://forum.watmm.com/topic/65193-post-your-favorite-code-snippet/ Share on other sites More sharing options...
Joyrex Posted April 7, 2011 Report Share Posted April 7, 2011 It would help to know what this does and why you classify it as your favourite... Thanks Haha Confused Sad Facepalm Burger Farnsworth Big Brain Like × Quote Hide all signatures Follow WATMM on Twitter: @WATMMOfficial Link to comment https://forum.watmm.com/topic/65193-post-your-favorite-code-snippet/#findComment-1554048 Share on other sites More sharing options...
TiffanyHalderman Posted April 7, 2011 Report Share Posted April 7, 2011 <script type="text/WATMM"> function confirmWATMM() { var WATMMness=confirm("Neckbeard?"); if (WATMMness==true) { alert("Welcome!"); } else { alert("Leave!"); } } </script> Thanks Haha Confused Sad Facepalm Burger Farnsworth Big Brain Like × Quote Hide TiffanyHalderman's signature Hide all signatures Burn that which lies to Oprah! Link to comment https://forum.watmm.com/topic/65193-post-your-favorite-code-snippet/#findComment-1554052 Share on other sites More sharing options...
acidphakist Posted April 7, 2011 Author Report Share Posted April 7, 2011 Sorry...it's python (obviously) and it's currently my favorite because I'm learning GUI development using wxPython. I won't bother to bore you with what it does seeing as this part is rather vanilla window setup. Thanks Haha Confused Sad Facepalm Burger Farnsworth Big Brain Like × Quote Hide acidphakist's signature Hide all signatures music Link to comment https://forum.watmm.com/topic/65193-post-your-favorite-code-snippet/#findComment-1554059 Share on other sites More sharing options...
Joyrex Posted April 7, 2011 Report Share Posted April 7, 2011 On 4/7/2011 at 7:56 PM, acidphakist said: Sorry...it's python (obviously) and it's currently my favorite because I'm learning GUI development using wxPython. I won't bother to bore you with what it does seeing as this part is rather vanilla window setup. Well, I don't think programming is boring - I'm not a Python coder myself, but I did read through it a bit after you posted it and gathered it was creating some sort of window... Python is one of those languages that always surprises how versatile it is. A free IDE I use, Editra, is written in Python... Thanks Haha Confused Sad Facepalm Burger Farnsworth Big Brain Like × Quote Hide all signatures Follow WATMM on Twitter: @WATMMOfficial Link to comment https://forum.watmm.com/topic/65193-post-your-favorite-code-snippet/#findComment-1554100 Share on other sites More sharing options...
jules Posted April 8, 2011 Report Share Posted April 8, 2011 i like how we can type facepalm with colons and have a come out. Thanks Haha Confused Sad Facepalm Burger Farnsworth Big Brain Like × Quote Hide jules's signature Hide all signatures Link to comment https://forum.watmm.com/topic/65193-post-your-favorite-code-snippet/#findComment-1554490 Share on other sites More sharing options...
Guest hahathhat Posted April 8, 2011 Report Share Posted April 8, 2011 while(1) fork(); Quote Link to comment https://forum.watmm.com/topic/65193-post-your-favorite-code-snippet/#findComment-1554526 Share on other sites More sharing options...
YEK Posted April 8, 2011 Report Share Posted April 8, 2011 up down left right a b a Thanks Haha Confused Sad Facepalm Burger Farnsworth Big Brain Like × Quote Hide YEK's signature Hide all signatures Reveal hidden contents !:/music Link to comment https://forum.watmm.com/topic/65193-post-your-favorite-code-snippet/#findComment-1554528 Share on other sites More sharing options...
Guest hahathhat Posted April 8, 2011 Report Share Posted April 8, 2011 (edited) SM 0 A9F4 G 0 Edited April 8, 2011 by hahathhat Quote Link to comment https://forum.watmm.com/topic/65193-post-your-favorite-code-snippet/#findComment-1554529 Share on other sites More sharing options...
SCONES TO DIE FOR Posted April 8, 2011 Report Share Posted April 8, 2011 <img src="URL"> Thanks Haha Confused Sad Facepalm Burger Farnsworth Big Brain Like × Quote Link to comment https://forum.watmm.com/topic/65193-post-your-favorite-code-snippet/#findComment-1554538 Share on other sites More sharing options...
chaosmachine Posted April 8, 2011 Report Share Posted April 8, 2011 Quote ssh -D 9999 -f -C -q -N you@yourserver.comecho I put on my socks. sets up a socks proxy over ssh which you can connect to on your localhost at port 9999. much simpler than setting up a vpn when you just want to do some encrypted surfing over public wifi, although you have to be careful to make sure your browser also tunnels the dns requests. Thanks Haha Confused Sad Facepalm Burger Farnsworth Big Brain Like × Quote Hide all signatures WATMM Link to comment https://forum.watmm.com/topic/65193-post-your-favorite-code-snippet/#findComment-1554541 Share on other sites More sharing options...
ericsosh Posted April 8, 2011 Report Share Posted April 8, 2011 Everybody's favorite fork bomb. :(){ :|:& };: Thanks Haha Confused Sad Facepalm Burger Farnsworth Big Brain Like × Quote Hide ericsosh's signature Hide all signatures Yo, my name is Saad and I don't give a fuck. Link to comment https://forum.watmm.com/topic/65193-post-your-favorite-code-snippet/#findComment-1554566 Share on other sites More sharing options...
Guest hahathhat Posted April 8, 2011 Report Share Posted April 8, 2011 (edited) i also love this one: (name this file fork.sh) #!/bin/sh ./fork.sh ./fork.sh i've drunkenly used it on people's iMacs. so nice of them to switch to unix. but it seems to have stopped tanking the system over the last few years... they walled it off a bit better... foo. Edited April 8, 2011 by hahathhat Quote Link to comment https://forum.watmm.com/topic/65193-post-your-favorite-code-snippet/#findComment-1554571 Share on other sites More sharing options...
Guest hahathhat Posted April 8, 2011 Report Share Posted April 8, 2011 On 4/8/2011 at 9:15 AM, Jonas said: 10 PRINT "read the rules" 20 GOTO 10 http://www.youtube.com/watch?v=qgFDMTJaVZE Quote Link to comment https://forum.watmm.com/topic/65193-post-your-favorite-code-snippet/#findComment-1554606 Share on other sites More sharing options...
Silent Member Posted April 8, 2011 Report Share Posted April 8, 2011 On 4/8/2011 at 9:23 AM, hahathhat said: On 4/8/2011 at 9:15 AM, Jonas said: 10 PRINT "read the rules" 20 GOTO 10 Thanks Haha Confused Sad Facepalm Burger Farnsworth Big Brain Like × Quote Hide Silent Member's signature Hide all signatures Some songs I made with my fingers and electronics. In the process of making some more. Hopefully. Reveal hidden contents Link to comment https://forum.watmm.com/topic/65193-post-your-favorite-code-snippet/#findComment-1554608 Share on other sites More sharing options...
chim Posted April 8, 2011 Report Share Posted April 8, 2011 On 4/8/2011 at 9:15 AM, Jonas said: 10 PRINT "read the rules" 20 GOTO 10 Thanks Haha Confused Sad Facepalm Burger Farnsworth Big Brain Like × Quote Link to comment https://forum.watmm.com/topic/65193-post-your-favorite-code-snippet/#findComment-1554652 Share on other sites More sharing options...
ericsosh Posted April 8, 2011 Report Share Posted April 8, 2011 fibs = 0 : scanl (+) 1 fibs Blew my mind when I first saw it. Thanks Haha Confused Sad Facepalm Burger Farnsworth Big Brain Like × Quote Hide ericsosh's signature Hide all signatures Yo, my name is Saad and I don't give a fuck. Link to comment https://forum.watmm.com/topic/65193-post-your-favorite-code-snippet/#findComment-1554690 Share on other sites More sharing options...
Guest Babar Posted April 8, 2011 Report Share Posted April 8, 2011 (edited) what does it do ? Nothing better than inform7. It's so transparent (and it's used to build textual games for those who don't know). Quote Holly Hop Drive is a woman in the fun room. holly hop drive is wearing a cardigan and trousers and a poppy. Understand "rape [someone]" as raping. Understand "fuck [someone]" as raping. raping is an action applying to one thing. Instead of examining holly: ....say "She is wearing [a list of things worn by the noun]." Instead of taking something which is worn by the holly: ....say "Holly violently shoves your away, Hey the [noun] is mine! Fucker!" Instead of kissing holly: ....say "She punches you square on the Jaw, then spits at your feet. Feisty!" Instead of searching holly: ....say "She screams Get your hand out of my pockets!!, and pushes you back." Instead of raping holly: ....say "She wrestles you to the ground, and overpowers you, which is freaking embarrassing. What's worse, is that she's wearing a strap-on, and has her way with you.". ; ....end the game saying "You were raped by a chick. You may as well klerck right now." also, i have a little problem : sometimes my neighbour, who uses our wifi network, downloads stuffs via bittorrent. As a result i get a ~1sec ping which is very annoying (most probably because he uploads more than what is allowed by our ISP (~128kb/s). Consequently, i launch a man in the middle kind of attack, so that i can monitor his traffic. As i'm using a mac, I use ipfw (and thus dummynet) in order to 'reshape' his traffic. Usually, i just create a pipe meant for packets i receive from him before redirecting them. I configure my pipe to have a 20kb/s bandwidth, and it usually works (my ping becomes normal again, around 60-80ms). Now what i'd like to do is something more supple : allowing him to do whatever the fuck he wants, but just give a stronger priority to my own packets. I tried: -creating a pipe with no bandwith limit, meant for "any to any" packets. -adding a queue to this pipe for packets coming from my neighbour's ip (with a weight of 1) -adding a queue to this pipe for other packets (including mine) (with a weight of 99). But… it doesn't work that well. My ping is still fucking high. Should i add a delay or a 'packet-dropping' factor ? Anyone ? Edited April 8, 2011 by Babar Quote Link to comment https://forum.watmm.com/topic/65193-post-your-favorite-code-snippet/#findComment-1554706 Share on other sites More sharing options...
acidphakist Posted April 8, 2011 Author Report Share Posted April 8, 2011 On 4/8/2011 at 6:52 AM, hahathhat said: while(1) fork(); fucking hacker. Thanks Haha Confused Sad Facepalm Burger Farnsworth Big Brain Like × Quote Hide acidphakist's signature Hide all signatures music Link to comment https://forum.watmm.com/topic/65193-post-your-favorite-code-snippet/#findComment-1554707 Share on other sites More sharing options...
acidphakist Posted April 8, 2011 Author Report Share Posted April 8, 2011 (edited) On 4/8/2011 at 2:32 PM, Babar said: what does it do ? Nothing better than inform7. It's so transparent (and it's used to build textual games for those who don't know). Quote Holly Hop Drive is a woman in the fun room. holly hop drive is wearing a cardigan and trousers and a poppy. Understand "rape [someone]" as raping. Understand "fuck [someone]" as raping. raping is an action applying to one thing. Instead of examining holly: ....say "She is wearing [a list of things worn by the noun]." Instead of taking something which is worn by the holly: ....say "Holly violently shoves your away, Hey the [noun] is mine! Fucker!" Instead of kissing holly: ....say "She punches you square on the Jaw, then spits at your feet. Feisty!" Instead of searching holly: ....say "She screams Get your hand out of my pockets!!, and pushes you back." Instead of raping holly: ....say "She wrestles you to the ground, and overpowers you, which is freaking embarrassing. What's worse, is that she's wearing a strap-on, and has her way with you.". ; ....end the game saying "You were raped by a chick. You may as well klerck right now." also, i have a little problem : sometimes my neighbour, who uses our wifi network, downloads stuffs via bittorrent. As a result i get a ~1sec ping which is very annoying (most probably because he uploads more than what is allowed by our ISP (~128kb/s). Consequently, i launch a man in the middle kind of attack, so that i can monitor his traffic. As i'm using a mac, I use ipfw (and thus dummynet) in order to 'reshape' his traffic. Usually, i just create a pipe meant for packets i receive from him before redirecting them. I configure my pipe to have a 20kb/s bandwidth, and it usually works (my ping becomes normal again, around 60-80ms). Now what i'd like to do is something more supple : allowing him to do whatever the fuck he wants, but just give a stronger priority to my own packets. I tried: -creating a pipe with no bandwith limit, meant for "any to any" packets. -adding a queue to this pipe for packets coming from my neighbour's ip (with a weight of 1) -adding a queue to this pipe for other packets (including mine) (with a weight of 99). But… it doesn't work that well. My ping is still fucking high. Should i add a delay or a 'packet-dropping' factor ? Anyone ? I don't know of any *nix software that allows for this kind of shaping. You'd likely require a dedicated router that can handle these types of policies. Also, where are these queues being implemented? The very fact you are using them could explain the latency incurred, Edited April 8, 2011 by acidphakist Thanks Haha Confused Sad Facepalm Burger Farnsworth Big Brain Like × Quote Hide acidphakist's signature Hide all signatures music Link to comment https://forum.watmm.com/topic/65193-post-your-favorite-code-snippet/#findComment-1554708 Share on other sites More sharing options...
Guest Babar Posted April 8, 2011 Report Share Posted April 8, 2011 As far as I understand, a queue is used to subdivide a pipe. For example, you set up a pipe for any packets with a maximal bandwidth of 1Mb/s. Then you add a queue for john's packets with a a weight of 10 and a queue for you own packets with a weight of 90. If you're both sending at 1Mb/s, you'll be ensured that john's packets are not being sended at more than 100kb/s. But i'm using these feature in a blind way. I don't know what happens to packets that are "paused/frozen" by the pipe/queue mechanism. Are they delayed ? Or dropped ? Also : I measured my ping before to start adding pipes and queues, so i'm fairly certain it is not caused by my own shady activities. According to a technician that works at my ISP, my router's cache gets clogged up, because it refuses to send at more than 128kb/s. Quote Link to comment https://forum.watmm.com/topic/65193-post-your-favorite-code-snippet/#findComment-1554718 Share on other sites More sharing options...
ericsosh Posted April 8, 2011 Report Share Posted April 8, 2011 On 4/8/2011 at 2:32 PM, Babar said: what does it do ? It builds a list containing the Fibonacci sequence. The amazing thing is that it is a recursive definition, yet it all works out because of the lazy evaluation Haskell has. Thanks Haha Confused Sad Facepalm Burger Farnsworth Big Brain Like × Quote Hide ericsosh's signature Hide all signatures Yo, my name is Saad and I don't give a fuck. Link to comment https://forum.watmm.com/topic/65193-post-your-favorite-code-snippet/#findComment-1554721 Share on other sites More sharing options...
Guest hahathhat Posted April 8, 2011 Report Share Posted April 8, 2011 On 4/8/2011 at 2:33 PM, acidphakist said: On 4/8/2011 at 6:52 AM, hahathhat said: while(1) fork(); fucking hacker. clearly, the elegance is lost on you. Quote Link to comment https://forum.watmm.com/topic/65193-post-your-favorite-code-snippet/#findComment-1554935 Share on other sites More sharing options...
chaosmachine Posted April 8, 2011 Report Share Posted April 8, 2011 nerd fight Thanks Haha Confused Sad Facepalm Burger Farnsworth Big Brain Like × Quote Hide all signatures WATMM Link to comment https://forum.watmm.com/topic/65193-post-your-favorite-code-snippet/#findComment-1554954 Share on other sites More sharing options...
acidphakist Posted April 8, 2011 Author Report Share Posted April 8, 2011 Chaosmachine, thanks for deleting my reply. I'm sure I looked like a real prick. Anyhow, I'll accept your 1337 h4x0r challenge any day of the week, hat. Thanks Haha Confused Sad Facepalm Burger Farnsworth Big Brain Like × Quote Hide acidphakist's signature Hide all signatures music Link to comment https://forum.watmm.com/topic/65193-post-your-favorite-code-snippet/#findComment-1554975 Share on other sites More sharing options...
Recommended Posts